Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: third_party/gsutil/boto/docs/source/boto_config_tut.rst

Issue 12317103: Added gsutil to depot tools (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: added readme Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 .. _ref-boto_config:
2
3 ===========
4 Boto Config
5 ===========
6
7 Introduction
8 ------------
9
10 There is a growing list of configuration options for the boto library. Many of
11 these options can be passed into the constructors for top-level objects such as
12 connections. Some options, such as credentials, can also be read from
13 environment variables (e.g. ``AWS_ACCESS_KEY_ID`` and ``AWS_SECRET_ACCESS_KEY``) .
14 But there is no central place to manage these options. So, the development
15 version of boto has now introduced the notion of boto config files.
16
17 Details
18 -------
19
20 A boto config file is simply a .ini format configuration file that specifies
21 values for options that control the behavior of the boto library. Upon startup,
22 the boto library looks for configuration files in the following locations
23 and in the following order:
24
25 * /etc/boto.cfg - for site-wide settings that all users on this machine will use
26 * ~/.boto - for user-specific settings
27
28 The options are merged into a single, in-memory configuration that is
29 available as :py:mod:`boto.config`. The :py:class:`boto.pyami.config.Config`
30 class is a subclass of the standard Python
31 :py:class:`ConfigParser.SafeConfigParser` object and inherits all of the
32 methods of that object. In addition, the boto
33 :py:class:`Config <boto.pyami.config.Config>` class defines additional
34 methods that are described on the PyamiConfigMethods page.
35
36 Sections
37 --------
38
39 The following sections and options are currently recognized within the
40 boto config file.
41
42 Credentials
43 ^^^^^^^^^^^
44
45 The Credentials section is used to specify the AWS credentials used for all
46 boto requests. The order of precedence for authentication credentials is:
47
48 * Credentials passed into Connection class constructor.
49 * Credentials specified by environment variables
50 * Credentials specified as options in the config file.
51
52 This section defines the following options: ``aws_access_key_id`` and
53 ``aws_secret_access_key``. The former being your aws key id and the latter
54 being the secret key.
55
56 For example::
57
58 [Credentials]
59 aws_access_key_id = <your access key>
60 aws_secret_access_key = <your secret key>
61
62 Please notice that quote characters are not used to either side of the '='
63 operator even when both your aws access key id and secret key are strings.
64
65 For greater security, the secret key can be stored in a keyring and
66 retrieved via the keyring package. To use a keyring, use ``keyring``,
67 rather than ``aws_secret_access_key``::
68
69 [Credentials]
70 aws_access_key_id = <your access key>
71 keyring = <keyring name>
72
73 To use a keyring, you must have the Python `keyring
74 <http://pypi.python.org/pypi/keyring>`_ package installed and in the
75 Python path. To learn about setting up keyrings, see the `keyring
76 documentation
77 <http://pypi.python.org/pypi/keyring#installing-and-using-python-keyring-lib>`_
78
79
80 Boto
81 ^^^^
82
83 The Boto section is used to specify options that control the operaton of
84 boto itself. This section defines the following options:
85
86 :debug: Controls the level of debug messages that will be printed by the boto li brary.
87 The following values are defined::
88
89 0 - no debug messages are printed
90 1 - basic debug messages from boto are printed
91 2 - all boto debugging messages plus request/response messages from http lib
92
93 :proxy: The name of the proxy host to use for connecting to AWS.
94 :proxy_port: The port number to use to connect to the proxy host.
95 :proxy_user: The user name to use when authenticating with proxy host.
96 :proxy_pass: The password to use when authenticating with proxy host.
97 :num_retries: The number of times to retry failed requests to an AWS server.
98 If boto receives an error from AWS, it will attempt to recover and retry the
99 request. The default number of retries is 5 but you can change the default
100 with this option.
101
102 As an example::
103
104 [Boto]
105 debug = 0
106 num_retries = 10
107
108 proxy = myproxy.com
109 proxy_port = 8080
110 proxy_user = foo
111 proxy_pass = bar
112
113 Precedence
114 ----------
115
116 Even if you have your boto config setup, you can also have credentials and
117 options stored in environmental variables or you can explicitly pass them to
118 method calls i.e.::
119
120 >>> boto.connect_ec2('<KEY_ID>','<SECRET_KEY>')
121
122 In these cases where these options can be found in more than one place boto
123 will first use the explicitly supplied arguments, if none found it will then
124 look for them amidst environment variables and if that fails it will use the
125 ones in boto config.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698