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
- DEFAULT_REFRESH_STATUS_CODES = (<HTTPStatus.UNAUTHORIZED: 401>,)¶
Which HTTP status code indicate that credentials should be refreshed and a request should be retried.
- DEFAULT_MAX_REFRESH_ATTEMPTS = 2¶
How many times to refresh the credentials and retry a request.
- class Response¶
HTTP Response data.
- class Request¶
Interface for a callable that makes HTTP requests.
Specific transport implementations should provide an implementation of this that adapts their specific request / response API.
- abstract __call__(url, method='GET', body=None, headers=None, timeout=None, **kwargs)¶
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.
kwargs – Additionally arguments passed on to the transport’s request method.
The HTTP response.
- Return type:
google.auth.exceptions.TransportError – If any exception occurred.