|        |   | 
- __builtin__.object
 - 
- AuthSubToken
 - 
- SecureAuthSubToken
  
 
- ClientLoginToken
 - OAuth2Token
 - 
- OAuth2TokenFromCredentials
  
 
- OAuthHmacToken
 - 
- OAuthRsaToken
 - 
- TwoLeggedOAuthRsaToken
  
 
- TwoLeggedOAuthHmacToken
  
 
 
 
- exceptions.Exception(exceptions.BaseException)
 - 
- Error
 - 
- OAuth2AccessTokenError
 - OAuth2RevokeError
 - UnsupportedTokenType
  
 
 
 
 
 
 
  
class AuthSubToken(__builtin__.object) |  
    
|     |   | 
Methods defined here: 
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, token_string, scopes=None)
  
- modify_request(self, http_request)
 - Sets Authorization header, allows app to act on the user's behalf.
  
 
Static methods defined here: 
- FromUrl = from_url(str_or_uri)
 - Creates a new AuthSubToken using information in the URL.
 
  
Uses auth_sub_string_from_url. 
  
Args: 
  str_or_uri: The current page's URL (as a str or atom.http_core.Uri) 
              which should contain a token query parameter since the 
              Google auth server redirected the user's browser to this 
              URL.  
- from_url(str_or_uri)
 - Creates a new AuthSubToken using information in the URL.
 
  
Uses auth_sub_string_from_url. 
  
Args: 
  str_or_uri: The current page's URL (as a str or atom.http_core.Uri) 
              which should contain a token query parameter since the 
              Google auth server redirected the user's browser to this 
              URL.  
 
Data descriptors defined here: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    
  
  
  
  
 
  
class OAuth2Token(__builtin__.object) |  
    
|     | 
Token object for OAuth 2.0 as described on 
<http://code.google.com/apis/accounts/docs/OAuth2.html>. 
  
Token can be applied to a gdata.client.GDClient object using the authorize() 
method, which then signs each request from that object with the OAuth 2.0 
access token. 
This class supports 3 flows of OAuth 2.0: 
  Client-side web flow: call generate_authorize_url with `response_type='token'' 
    and the registered `redirect_uri'. 
  Server-side web flow: call generate_authorize_url with the registered 
    `redirect_url'. 
  Native applications flow: call generate_authorize_url as it is. You will have 
    to ask the user to go to the generated url and pass in the authorization 
    code to your application.   |  
|   | 
Methods defined here: 
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, client_id, client_secret, scope, user_agent, auth_uri='https://accounts.google.com/o/oauth2/auth', token_uri='https://accounts.google.com/o/oauth2/token', access_token=None, refresh_token=None, revoke_uri='https://accounts.google.com/o/oauth2/revoke')
 - Create an instance of OAuth2Token
 
  
Args: 
  client_id: string, client identifier. 
  client_secret: string client secret. 
  scope: string, scope of the credentials being requested. 
  user_agent: string, HTTP User-Agent to provide for this application. 
  auth_uri: string, URI for authorization endpoint. For convenience 
    defaults to Google's endpoints but any OAuth 2.0 provider can be used. 
  token_uri: string, URI for token endpoint. For convenience 
    defaults to Google's endpoints but any OAuth 2.0 provider can be used. 
  revoke_uri: string, URI for revoke endpoint. For convenience 
    defaults to Google's endpoints but any OAuth 2.0 provider can be used. 
  access_token: string, access token. 
  refresh_token: string, refresh token.  
- authorize(self, client)
 - Authorize a gdata.client.GDClient instance with these credentials.
 
  
Args: 
   client: An instance of gdata.client.GDClient 
       or something that acts like it. 
  
Returns: 
   A modified instance of client that was passed in. 
  
Example: 
  >>> c = gdata.client.GDClient(source='user-agent') 
  >>> c = token.authorize(c)  
- generate_authorize_url(self, redirect_uri='urn:ietf:wg:oauth:2.0:oob', response_type='code', access_type='offline', approval_prompt='auto', **kwargs)
 - Returns a URI to redirect to the provider.
 
  
Args: 
  redirect_uri: Either the string 'urn:ietf:wg:oauth:2.0:oob' for a 
                non-web-based application, or a URI that handles the 
                callback from the authorization server. 
  response_type: Either the string 'code' for server-side or native 
                 application, or the string 'token' for client-side 
                 application. 
  access_type: Either the string 'offline' to request a refresh token or 
               'online'. 
  approval_prompt: Either the string 'auto' to let the OAuth mechanism 
                   determine if the approval page is needed or 'force' 
                   if the approval prompt is desired in all cases. 
  
If redirect_uri is 'urn:ietf:wg:oauth:2.0:oob' then pass in the 
generated verification code to get_access_token, 
otherwise pass in the query parameters received 
at the callback uri to get_access_token. 
If the response_type is 'token', no need to call 
get_access_token as the API will return it within 
the query parameters received at the callback: 
  oauth2_token.access_token = YOUR_ACCESS_TOKEN  
- get_access_token(self, code)
 - Exhanges a code for an access token.
 
  
Args: 
  code: string or dict, either the code as a string, or a dictionary 
    of the query parameters to the redirect_uri, which contains 
    the code.  
- modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Returns: 
  The same HTTP request object which was passed in.  
- revoke(self, revoke_uri=None, refresh_token=None)
 - Revokes access via a refresh token.
 
  
Args: 
  revoke_uri: string, URI for revoke endpoint. If not provided, or if 
    None is provided, the revoke_uri attribute on the object is used. 
  refresh_token: string, refresh token. If not provided, or if None is 
    provided, the refresh_token attribute on the object is used. 
  
Raises: 
  UnsupportedTokenType if the token is not one of the supported token 
  classes listed above. 
  
Example: 
  >>> token.revoke()  
 
Data descriptors defined here: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
- invalid
 
- True if the credentials are invalid, such as being revoked.
 
 
 |    
 
  
class OAuth2TokenFromCredentials(OAuth2Token) |  
    
|     | 
Special subclass to be used in conjunction with google-api-python-client. 
  
These libraries are built for different purposes. This one is used for APIs 
that use the GData Protocol: 
https://developers.google.com/gdata/docs/2.0/reference 
while google-api-python-client is for APIs which are discovery-based: 
https://developers.google.com/discovery/v1/getting_started#background 
  
Developers using Google APIs may want to use both simultaneously, and this 
class provides a way for them to use OAuth 2.0 credentials obtained for use 
with google-api-python-client as credentials in gdata-python-client and to 
ensure all token/credential refresh impacts both this object and the 
google-api-python-client credentials object. 
  
In addition, any manual patching of this object or the credentials object will 
be immediately reflected since attributes such as `client_id`, `access_token`, 
etc. are directly proxied between instances of this class and the credentials 
objects that they own.   |  
|   | 
- Method resolution order:
 
- OAuth2TokenFromCredentials
 
- OAuth2Token
 
- __builtin__.object
 
 
 
Methods defined here: 
- __init__(self, credentials)
 - Constructor for OAuth2TokenFromCredentials object.
 
  
The constructor for the superclass is not called because the actual values 
are retrieved from the credentials object directly via `property` instances 
which act as proxies. 
  
Args: 
  credentials: An instance of oauth2client.client.Credentials or some 
      subclass.  
- generate_authorize_url(self, *args, **kwargs)
 - # Disable methods not supported by Credentials.
  
- get_access_token(self, *args, **kwargs)
  
- revoke(self, *args, **kwargs)
  
 
Data descriptors defined here: 
- access_token
 
 
- client_id
 
 
- client_secret
 
 
- refresh_token
 
 
- token_expiry
 
 
- token_uri
 
 
- user_agent
 
 
 
Methods inherited from OAuth2Token: 
- ModifyRequest = modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Returns: 
  The same HTTP request object which was passed in.  
- authorize(self, client)
 - Authorize a gdata.client.GDClient instance with these credentials.
 
  
Args: 
   client: An instance of gdata.client.GDClient 
       or something that acts like it. 
  
Returns: 
   A modified instance of client that was passed in. 
  
Example: 
  >>> c = gdata.client.GDClient(source='user-agent') 
  >>> c = token.authorize(c)  
- modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Returns: 
  The same HTTP request object which was passed in.  
 
Data descriptors inherited from OAuth2Token: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
- invalid
 
- True if the credentials are invalid, such as being revoked.
 
 
 |    
 
  
class OAuthHmacToken(__builtin__.object) |  
    
|     |   | 
Methods defined here: 
- GenerateAuthorizationUrl = generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
  
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, consumer_key, consumer_secret, token, token_secret, auth_state, next=None, verifier=None)
  
- generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
- modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Calculates an HMAC signature using the information in the token to 
indicate that the request came from this application and that this 
application has permission to access a particular user's data. 
  
Returns: 
  The same HTTP request object which was passed in.  
 
Data descriptors defined here: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 
Data and other attributes defined here: 
- SIGNATURE_METHOD = 'HMAC-SHA1'
  
 |    
 
  
class OAuthRsaToken(OAuthHmacToken) |  
    
|     |   | 
- Method resolution order:
 
- OAuthRsaToken
 
- OAuthHmacToken
 
- __builtin__.object
 
 
 
Methods defined here: 
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, consumer_key, rsa_private_key, token, token_secret, auth_state, next=None, verifier=None)
  
- modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Calculates an RSA signature using the information in the token to 
indicate that the request came from this application and that this 
application has permission to access a particular user's data. 
  
Returns: 
  The same HTTP request object which was passed in.  
 
Data and other attributes defined here: 
- SIGNATURE_METHOD = 'RSA-SHA1'
  
 
Methods inherited from OAuthHmacToken: 
- GenerateAuthorizationUrl = generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
- generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
 
Data descriptors inherited from OAuthHmacToken: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    
 
  
class SecureAuthSubToken(AuthSubToken) |  
    
|     |   | 
- Method resolution order:
 
- SecureAuthSubToken
 
- AuthSubToken
 
- __builtin__.object
 
 
 
Methods defined here: 
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, token_string, rsa_private_key, scopes=None)
  
- modify_request(self, http_request)
 - Sets the Authorization header and includes a digital signature.
 
  
Calculates a digital signature using the private RSA key, a timestamp 
(uses now at the time this method is called) and a random nonce. 
  
Args: 
  http_request: The atom.http_core.HttpRequest which contains all of the 
      information needed to send a request to the remote server. The 
      URL and the method of the request must be already set and cannot be 
      changed after this token signs the request, or the signature will 
      not be valid.  
 
Static methods defined here: 
- FromUrl = from_url(str_or_uri, rsa_private_key)
 - Creates a new SecureAuthSubToken using information in the URL.
 
  
Uses auth_sub_string_from_url. 
  
Args: 
  str_or_uri: The current page's URL (as a str or atom.http_core.Uri) 
      which should contain a token query parameter since the Google auth 
      server redirected the user's browser to this URL. 
  rsa_private_key: str the private RSA key cert used to sign all requests 
      made with this token.  
- from_url(str_or_uri, rsa_private_key)
 - Creates a new SecureAuthSubToken using information in the URL.
 
  
Uses auth_sub_string_from_url. 
  
Args: 
  str_or_uri: The current page's URL (as a str or atom.http_core.Uri) 
      which should contain a token query parameter since the Google auth 
      server redirected the user's browser to this URL. 
  rsa_private_key: str the private RSA key cert used to sign all requests 
      made with this token.  
 
Data descriptors inherited from AuthSubToken: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    
 
  
class TwoLeggedOAuthHmacToken(OAuthHmacToken) |  
    
|     |   | 
- Method resolution order:
 
- TwoLeggedOAuthHmacToken
 
- OAuthHmacToken
 
- __builtin__.object
 
 
 
Methods defined here: 
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, consumer_key, consumer_secret, requestor_id)
  
- modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Calculates an HMAC signature using the information in the token to 
indicate that the request came from this application and that this 
application has permission to access a particular user's data using 2LO. 
  
Returns: 
  The same HTTP request object which was passed in.  
 
Methods inherited from OAuthHmacToken: 
- GenerateAuthorizationUrl = generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
- generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
 
Data descriptors inherited from OAuthHmacToken: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 
Data and other attributes inherited from OAuthHmacToken: 
- SIGNATURE_METHOD = 'HMAC-SHA1'
  
 |    
 
  
class TwoLeggedOAuthRsaToken(OAuthRsaToken) |  
    
|     |   | 
- Method resolution order:
 
- TwoLeggedOAuthRsaToken
 
- OAuthRsaToken
 
- OAuthHmacToken
 
- __builtin__.object
 
 
 
Methods defined here: 
- ModifyRequest = modify_request(self, http_request)
  
- __init__(self, consumer_key, rsa_private_key, requestor_id)
  
- modify_request(self, http_request)
 - Sets the Authorization header in the HTTP request using the token.
 
  
Calculates an RSA signature using the information in the token to 
indicate that the request came from this application and that this 
application has permission to access a particular user's data using 2LO. 
  
Returns: 
  The same HTTP request object which was passed in.  
 
Data and other attributes inherited from OAuthRsaToken: 
- SIGNATURE_METHOD = 'RSA-SHA1'
  
 
Methods inherited from OAuthHmacToken: 
- GenerateAuthorizationUrl = generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
- generate_authorization_url(self, google_apps_domain='default', language=None, btmpl=None, auth_server='https://www.google.com/accounts/OAuthAuthorizeToken')
 - Creates the URL at which the user can authorize this app to access.
 
  
Args: 
  google_apps_domain: str (optional) If the user should be signing in 
      using an account under a known Google Apps domain, provide the 
      domain name ('example.com') here. If not provided, 'default' 
      will be used, and the user will be prompted to select an account 
      if they are signed in with a Google Account and Google Apps 
      accounts. 
  language: str (optional) An ISO 639 country code identifying what 
      language the approval page should be translated in (for example, 
      'en' for English). The default is the user's selected language. 
  btmpl: str (optional) Forces a mobile version of the approval page. The 
    only accepted value is 'mobile'. 
  auth_server: str (optional) The start of the token authorization web 
    page. Defaults to 
    'https://www.google.com/accounts/OAuthAuthorizeToken'  
 
Data descriptors inherited from OAuthHmacToken: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    
  |