Package oauth2client :: Module client :: Class Credentials |
[hide private]
[frames] | no frames]

# Class Credentials

source code

    Base class for all Credentials objects.

    Subclasses must define an authorize() method that applies the credentials to
    an HTTP transport.

    Subclasses must also specify a classmethod named 'from_json' that takes a JSON
    string as input and returns an instaniated Credentials object.

Instance Methods | [hide private]
authorize(self, http) Take an httplib2.Http instance (or equivalent) and authorizes it. | source code
refresh(self, http) Forces a refresh of the access_token. | source code
revoke(self, http) Revokes a refresh_token and makes the credentials void. | source code
apply(self, headers) Add the authorization to the headers. | source code
_to_json(self, strip) Utility function that creates JSON repr. | source code
to_json(self) Creating a JSON representation of an instance of Credentials. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Methods | [hide private]
new_from_json(cls, s) Utility class method to instantiate a Credentials subclass from a JSON representation produced by to_json(). | source code
from_json(cls, s) Instantiate a Credentials object from a JSON description of it. | source code

Class Variables | [hide private]
| NON_SERIALIZED_MEMBERS = `['store']`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### authorize(self, http) | source code
    Take an httplib2.Http instance (or equivalent) and authorizes it.

    Authorizes it for the set of credentials, usually by replacing
    http.request() with a method that adds in the appropriate headers and then
    delegates to the original Http.request() method.

    Args:
      http: httplib2.Http, an http object to be used to make the refresh
        request.

### refresh(self, http) | source code
    Forces a refresh of the access_token.

    Args:
      http: httplib2.Http, an http object to be used to make the refresh
        request.

### revoke(self, http) | source code
    Revokes a refresh_token and makes the credentials void.

    Args:
      http: httplib2.Http, an http object to be used to make the revoke
        request.

### apply(self, headers) | source code
    Add the authorization to the headers.

    Args:
      headers: dict, the headers to add the Authorization header to.

### _to_json(self, strip) | source code
    Utility function that creates JSON repr. of a Credentials object.

    Args:
      strip: array, An array of names of members to not include in the JSON.

    Returns:
       string, a JSON representation of this instance, suitable to pass to
       from_json().

### to_json(self) | source code
    Creating a JSON representation of an instance of Credentials.

    Returns:
       string, a JSON representation of this instance, suitable to pass to
       from_json().

### new_from_json(cls, s) Class Method | source code
    Utility class method to instantiate a Credentials subclass from a JSON
    representation produced by to_json().

    Args:
      s: string, JSON from to_json().

    Returns:
      An instance of the subclass of Credentials that was serialized with
      to_json().

### from_json(cls, s) Class Method | source code
    Instantiate a Credentials object from a JSON description of it.

    The JSON should have been produced by calling .to_json() on the object.

    Args:
      data: dict, A deserialized JSON object.

    Returns:
      An instance of a Credentials subclass.