oauth2client.contrib.keyring_storage module

A keyring based Storage.

A Storage for Credentials that uses the keyring module.

class oauth2client.contrib.keyring_storage.Storage(service_name, user_name)[source]

Bases: oauth2client.client.Storage

Store and retrieve a single credential to and from the keyring.

To use this module you must have the keyring module installed. See <http://pypi.python.org/pypi/keyring/>. This is an optional module and is not installed with oauth2client by default because it does not work on all the platforms that oauth2client supports, such as Google App Engine.

The keyring module <http://pypi.python.org/pypi/keyring/> is a cross-platform library for access the keyring capabilities of the local system. The user will be prompted for their keyring password when this module is used, and the manner in which the user is prompted will vary per platform.


from oauth2client import keyring_storage

s = keyring_storage.Storage('name_of_application', 'user1')
credentials = s.get()

Delete Credentials file.

Parameters:credentials – Credentials, the credentials to store.

Retrieve Credential from file.


Write Credentials to file.

Parameters:credentials – Credentials, the credentials to store.