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

# Module clientsecrets

source code

    Utilities for reading OAuth 2.0 client secret files.

    A client_secrets.json file contains all the information needed to interact with
    an OAuth 2.0 protected service.

Author: jcgregorio@google.com (Joe Gregorio)

Classes | [hide private]
| Error Base error for this module.
| InvalidClientSecretsError Format of ClientSecrets file is invalid.

Functions | [hide private]
_validate_clientsecrets(obj) | source code
load(fp) | source code
loads(s) | source code
_loadfile(filename) | source code
loadfile(filename, cache=None) Loading of client_secrets JSON file, optionally backed by a cache. | source code

Variables | [hide private]
| TYPE_WEB = `'web'`
| TYPE_INSTALLED = `'installed'`
| VALID_CLIENT = `{TYPE_WEB: {'required': ['client_id', 'client_s`...``

Function Details | [hide private]

### loadfile(filename, cache=None) | source code
    Loading of client_secrets JSON file, optionally backed by a cache.

    Typical cache storage would be App Engine memcache service,
    but you can pass in any other cache client that implements
    these methods:
      - get(key, namespace=ns)
      - set(key, value, namespace=ns)

    Usage:
      # without caching
      client_type, client_info = loadfile('secrets.json')
      # using App Engine memcache service
      from google.appengine.api import memcache
      client_type, client_info = loadfile('secrets.json', cache=memcache)

    Args:
      filename: string, Path to a client_secrets.json file on a filesystem.
      cache: An optional cache service client that implements get() and set()
        methods. If not specified, the file is always being loaded from
        a filesystem.

    Raises:
      InvalidClientSecretsError: In case of a validation error or some
        I/O failure. Can happen only on cache miss.

    Returns:
      (client_type, client_info) tuple, as _loadfile() normally would.
      JSON contents is validated only during first load. Cache hits are not
      validated.

Variables Details | [hide private]

  ### VALID_CLIENT Value:
      {TYPE_WEB: {'required': ['client_id', 'client_secret', 'redirect_uris'
      , 'auth_uri', 'token_uri',], 'string': ['client_id', 'client_secret',]
      ,}, TYPE_INSTALLED: {'required': ['client_id', 'client_secret', 'redir
      ect_uris', 'auth_uri', 'token_uri',], 'string': ['client_id', 'client_
      secret',],},}