README.md
1 # gcs-oauth2-boto-plugin
2
3 gcs-oauth2-boto-plugin is a Python application whose purpose is to behave as
4 an auth plugin for the [boto] auth plugin framework for use with [OAuth 2.0]
5 credentials for the Google Cloud Platform. This plugin is compatible with
6 both [user accounts] and [service accounts], and its functionality is
7 essentially a wrapper around the oauth2client package of
8 [google-api-python-client] with the addition of automatically caching tokens
9 for the machine in a thread- and process-safe fashion.
10
11 For more information about how to use this plugin to access Google Cloud Storage
12 via boto in your application, see the [GCS documentation].
13
14 If you wish to use this plugin without using the PyPI install as instructed in
15 the documentation (e.g., for development), then you will need to manually
16 acquire the modules from the requirements.txt file.
17
18
19 When using this plugin, you must specify a client ID and secret. We offer the
20 following methods for providing this information; if multiple methods are used,
21 we will choose them in the following order:
22
23 1. .boto config, if not set
24 2. environment variables (OAUTH2_CLIENT_ID and OAUTH2_CLIENT_SECRET), if not set
25 3. CLIENT_ID and CLIENT_SECRET values set by SetFallbackClientIdAndSecret function.
26
27 Service accounts are supported via key files in either JSON or .p12 format.
28 The file is first interpreted as JSON, with .p12 format as a fallback.
29
30 The default locking mechanism used is threading.Lock. You can switch to using
31 another locking mechanism by calling SetLock. Example:
32
33 ```
34 SetLock(multiprocessing.Manager().Lock())
35 ```
36
37
38 Before submitting any code, please run the tests (e.g., by running the following
39 command from the root of this repository):
40
41 PYTHONPATH="." python -m gcs_oauth2_boto_plugin.test_oauth2_client
42
43 [boto]: https://github.com/boto/boto
44 [OAuth 2.0]: https://developers.google.com/accounts/docs/OAuth2Login
45 [user accounts]: https://developers.google.com/accounts/docs/OAuth2#installed
46 [service accounts]: https://developers.google.com/accounts/docs/OAuth2#serviceaccount
47 [google-api-python-client]: https://code.google.com/p/google-api-python-client/wiki/OAuth2Client
48 [GCS documentation]: https://developers.google.com/storage/docs/gspythonlibrary
49