oauth2client.transport module¶
-
class
oauth2client.transport.
MemoryCache
[source]¶ Bases:
object
httplib2 Cache implementation which only caches locally.
-
oauth2client.transport.
clean_headers
(headers)[source]¶ Forces header keys and values to be strings, i.e not unicode.
The httplib module just concats the header keys and values in a way that may make the message header a unicode string, which, if it then tries to contatenate to a binary request body may result in a unicode decode error.
Parameters: headers – dict, A dictionary of headers. Returns: The same dictionary but with all the keys converted to strings.
-
oauth2client.transport.
get_cached_http
()[source]¶ Return an HTTP object which caches results returned.
This is intended to be used in methods like oauth2client.client.verify_id_token(), which calls to the same URI to retrieve certs.
Returns: httplib2.Http, an HTTP object with a MemoryCache
-
oauth2client.transport.
get_http_object
()[source]¶ Return a new HTTP object.
Returns: httplib2.Http, an HTTP object.
-
oauth2client.transport.
wrap_http_for_auth
(credentials, http)[source]¶ Prepares an HTTP object’s request method for auth.
Wraps HTTP requests with logic to catch auth failures (typically identified via a 401 status code). In the event of failure, tries to refresh the token used and then retry the original request.
Parameters: - credentials – Credentials, the credentials used to identify the authenticated user.
- http – httplib2.Http, an http object to be used to make auth requests.
-
oauth2client.transport.
wrap_http_for_jwt_access
(credentials, http)[source]¶ Prepares an HTTP object’s request method for JWT access.
Wraps HTTP requests with logic to catch auth failures (typically identified via a 401 status code). In the event of failure, tries to refresh the token used and then retry the original request.
Parameters: - credentials – _JWTAccessCredentials, the credentials used to identify a service account that uses JWT access tokens.
- http – httplib2.Http, an http object to be used to make auth requests.