google.auth.transport package

Transport - HTTP client library support.

google.auth is designed to work with various HTTP client libraries such as urllib3 and requests. In order to work across these libraries with different interfaces some abstraction is needed.

This module provides two interfaces that are implemented by transport adapters to support HTTP libraries. Request defines the interface expected by google.auth to make requests. Response defines the interface for the return value of Request.


Sequence [ int ] – Which HTTP status code indicate that credentials should be refreshed and a request should be retried.


int – How many times to refresh the credentials and retry a request.

class Response[source]

Bases: object

HTTP Response data.


int – The HTTP status code.


Mapping [ str, str ] – The HTTP response headers.


bytes – The response body.

class Request[source]

Bases: object

Interface for a callable that makes HTTP requests.

Specific transport implementations should provide an implementation of this that adapts their specific request / response API.

__call__(url, method='GET', body=None, headers=None, timeout=None, **kwargs)[source]

Make an HTTP request.

  • url (str) – The URI to be requested.
  • method (str) – The HTTP method to use for the request. Defaults to ‘GET’.
  • body (bytes) – The payload / body in HTTP request.
  • headers (Mapping [ str, str ]) – Request headers.
  • timeout (Optional [ int ]) – The number of seconds to wait for a response from the server. If not specified or if None, the transport-specific default timeout will be used.
  • kwargs – Additionally arguments passed on to the transport’s request method.

The HTTP response.

Return type:



google.auth.exceptions.TransportError – If any exception occurred.