Package oauth2client :: Module multistore_file
[hide private]
[frames] | no frames]

Module multistore_file

source code

Multi-credential file store with lock support.

This module implements a JSON credential store where multiple
credentials can be stored in one file.  That file supports locking
both in a single process and across processes.

The credential themselves are keyed off of:
* client_id
* user_agent
* scope

The format of the stored data is like so:
{
  'file_version': 1,
  'data': [
    {
      'key': {
        'clientId': '<client id>',
        'userAgent': '<user agent>',
        'scope': '<scope>'
      },
      'credential': {
        # JSON serialized Credentials.
      }
    }
  ]
}


Author: jbeda@google.com (Joe Beda)

Classes [hide private]
  Error
Base error for this module.
  NewerCredentialStoreError
The credential store is a newer version that supported.
  _MultiStore
A file backed store for multiple credentials.
Functions [hide private]
 
get_credential_storage(filename, client_id, user_agent, scope, warn_on_readonly=True)
Get a Storage instance for a credential.
source code
Variables [hide private]
  logger = logging.getLogger(__name__)
  _multistores = {}
  _multistores_lock = threading.Lock()
  __package__ = 'oauth2client'
Function Details [hide private]

get_credential_storage(filename, client_id, user_agent, scope, warn_on_readonly=True)

source code 
Get a Storage instance for a credential.

Args:
  filename: The JSON file storing a set of credentials
  client_id: The client_id for the credential
  user_agent: The user agent for the credential
  scope: string or list of strings, Scope(s) being requested
  warn_on_readonly: if True, log a warning if the store is readonly

Returns:
  An object derived from client.Storage for getting/setting the
  credential.