Package oauth2client :: Module keyring_storage :: Class Storage
[hide private]
[frames] | no frames]

Class Storage

source code


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.

Usage:
  from oauth2client.keyring_storage import Storage

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

Instance Methods [hide private]
 
__init__(self, service_name, user_name)
Constructor.
source code
 
acquire_lock(self)
Acquires any lock necessary to access this Storage.
source code
 
release_lock(self)
Release the Storage lock.
source code
 
locked_get(self)
Retrieve Credential from file.
source code
 
locked_put(self, credentials)
Write Credentials to file.
source code
 
locked_delete(self)
Delete Credentials file.
source code

Inherited from client.Storage: delete, get, put

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, service_name, user_name)
(Constructor)

source code 
Constructor.

Args:
  service_name: string, The name of the service under which the credentials
    are stored.
  user_name: string, The name of the user to store credentials for.

Overrides: object.__init__

acquire_lock(self)

source code 
Acquires any lock necessary to access this Storage.

This lock is not reentrant.

Overrides: client.Storage.acquire_lock

release_lock(self)

source code 
Release the Storage lock.

Trying to release a lock that isn't held will result in a
RuntimeError.

Overrides: client.Storage.release_lock

locked_get(self)

source code 
Retrieve Credential from file.

Returns:
  oauth2client.client.Credentials

Overrides: client.Storage.locked_get

locked_put(self, credentials)

source code 
Write Credentials to file.

Args:
  credentials: Credentials, the credentials to store.

Overrides: client.Storage.locked_put

locked_delete(self)

source code 
Delete Credentials file.

Args:
  credentials: Credentials, the credentials to store.

Overrides: client.Storage.locked_delete