Interfaces for credentials.
Bases: _BaseCredentials
Base class for all credentials.
All credentials have a token
that is used for authentication and may also optionally set an expiry
to indicate when the token will no longer be valid.
Most credentials will be invalid
until refresh()
is called. Credentials can do this automatically before the first HTTP request in before_request()
.
Although the token and expiration will change as the credentials are refreshed
and used, credentials should be considered immutable. Various credentials will accept configuration such as private keys, scopes, and other options. These options are not changeable after construction. Some classes will provide mechanisms to copy the credentials with modifications such as ScopedCredentials.with_scopes()
.
When the token expires and is no longer valid. If this is None, the token is assumed to never expire.
Checks if the credentials are expired.
Note that credentials can be invalid but not expired because Credentials with expiry
set to None is considered to never expire.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
Checks the validity of the credentials.
This is True if the credentials have a token
and the token is not expired
.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
See :obj:`TokenState
Project to use for quota and billing purposes.
The universe domain value.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Refreshes the access token.
request (google.auth.transport.Request) – The object used to make HTTP requests.
google.auth.exceptions.RefreshError – If the credentials could not be refreshed.
Apply the token to the authentication header.
Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls apply()
to apply the token to the authentication header.
request (google.auth.transport.Request) – The object used to make HTTP requests.
method (str) – The request’s HTTP method or the RPC method being invoked.
url (str) – The request’s URI or the RPC service’s URI.
headers (Mapping) – The request’s headers.
Bases: Credentials
Abstract base for credentials supporting with_quota_project
factory
Returns a copy of these credentials with a modified quota project.
quota_project_id (str) – The project to use for quota and billing purposes
A new credentials instance.
Apply the token to the authentication header.
Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls apply()
to apply the token to the authentication header.
request (google.auth.transport.Request) – The object used to make HTTP requests.
method (str) – The request’s HTTP method or the RPC method being invoked.
url (str) – The request’s URI or the RPC service’s URI.
headers (Mapping) – The request’s headers.
Checks if the credentials are expired.
Note that credentials can be invalid but not expired because Credentials with expiry
set to None is considered to never expire.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Project to use for quota and billing purposes.
Refreshes the access token.
request (google.auth.transport.Request) – The object used to make HTTP requests.
google.auth.exceptions.RefreshError – If the credentials could not be refreshed.
See :obj:`TokenState
The universe domain value.
Checks the validity of the credentials.
This is True if the credentials have a token
and the token is not expired
.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
Bases: Credentials
Abstract base for credentials supporting with_token_uri
factory
Returns a copy of these credentials with a modified token uri.
token_uri (str) – The uri to use for fetching/exchanging tokens
A new credentials instance.
Apply the token to the authentication header.
Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls apply()
to apply the token to the authentication header.
request (google.auth.transport.Request) – The object used to make HTTP requests.
method (str) – The request’s HTTP method or the RPC method being invoked.
url (str) – The request’s URI or the RPC service’s URI.
headers (Mapping) – The request’s headers.
Checks if the credentials are expired.
Note that credentials can be invalid but not expired because Credentials with expiry
set to None is considered to never expire.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Project to use for quota and billing purposes.
Refreshes the access token.
request (google.auth.transport.Request) – The object used to make HTTP requests.
google.auth.exceptions.RefreshError – If the credentials could not be refreshed.
See :obj:`TokenState
The universe domain value.
Checks the validity of the credentials.
This is True if the credentials have a token
and the token is not expired
.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
Bases: Credentials
Abstract base for credentials supporting with_universe_domain
factory
Returns a copy of these credentials with a modified universe domain.
universe_domain (str) – The universe domain to use
A new credentials instance.
Apply the token to the authentication header.
Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls apply()
to apply the token to the authentication header.
request (google.auth.transport.Request) – The object used to make HTTP requests.
method (str) – The request’s HTTP method or the RPC method being invoked.
url (str) – The request’s URI or the RPC service’s URI.
headers (Mapping) – The request’s headers.
Checks if the credentials are expired.
Note that credentials can be invalid but not expired because Credentials with expiry
set to None is considered to never expire.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Project to use for quota and billing purposes.
Refreshes the access token.
request (google.auth.transport.Request) – The object used to make HTTP requests.
google.auth.exceptions.RefreshError – If the credentials could not be refreshed.
See :obj:`TokenState
The universe domain value.
Checks the validity of the credentials.
This is True if the credentials have a token
and the token is not expired
.
Deprecated since version v2.24.0: Prefer checking token_state
instead.
Bases: Credentials
Credentials that do not provide any authentication information.
These are useful in the case of services that support anonymous access or local service emulators that do not use credentials.
Returns False, anonymous credentials never expire.
Returns True, anonymous credentials are always valid.
Raises :class:InvalidOperation
, anonymous credentials cannot be refreshed.
Anonymous credentials do nothing to the request.
The optional token
argument is not supported.
google.auth.exceptions.InvalidValue – If a token was specified.
Anonymous credentials do nothing to the request.
The credential information JSON.
The credential information will be added to auth related error messages by client library.
Project to use for quota and billing purposes.
See :obj:`TokenState
The universe domain value.
Bases: object
Interface for credentials whose scopes can be queried.
OAuth 2.0-based credentials allow limiting access using scopes as described in RFC6749 Section 3.3. If a credential class implements this interface then the credentials either use scopes in their implementation.
Some credentials require scopes in order to obtain a token. You can check if scoping is necessary with requires_scopes
:
if credentials.requires_scopes: # Scoping is required. credentials = credentials.with_scopes(scopes=['one', 'two'])
Credentials that require scopes must either be constructed with scopes:
credentials = SomeScopedCredentials(scopes=['one', 'two'])
Or must copy an existing instance using with_scopes()
:
scoped_credentials = credentials.with_scopes(scopes=['one', 'two'])
Some credentials have scopes but do not allow or require scopes to be set, these credentials can be used as-is.
True if these credentials require scopes to obtain an access token.
Bases: ReadOnlyScoped
Interface for credentials whose scopes can be replaced while copying.
OAuth 2.0-based credentials allow limiting access using scopes as described in RFC6749 Section 3.3. If a credential class implements this interface then the credentials either use scopes in their implementation.
Some credentials require scopes in order to obtain a token. You can check if scoping is necessary with requires_scopes
:
if credentials.requires_scopes: # Scoping is required. credentials = credentials.create_scoped(['one', 'two'])
Credentials that require scopes must either be constructed with scopes:
credentials = SomeScopedCredentials(scopes=['one', 'two'])
Or must copy an existing instance using with_scopes()
:
scoped_credentials = credentials.with_scopes(scopes=['one', 'two'])
Some credentials have scopes but do not allow or require scopes to be set, these credentials can be used as-is.
Create a copy of these credentials with the specified scopes.
scopes (Sequence
str
) – The list of scopes to attach to the current credentials.
NotImplementedError – If the credentials’ scopes can not be changed. This can be avoided by checking requires_scopes
before calling this method.
Checks if the credentials have the given scopes.
True if these credentials require scopes to obtain an access token.
Creates a copy of the credentials with scopes if scoping is required.
This helper function is useful when you do not know (or care to know) the specific type of credentials you are using (such as when you use google.auth.default()
). This function will call Scoped.with_scopes()
if the credentials are scoped credentials and if the credentials require scoping. Otherwise, it will return the credentials as-is.
credentials (google.auth.credentials.Credentials) – The credentials to scope if necessary.
default_scopes (Sequence
str
) – Default scopes passed by a Google client library. Use ‘scopes’ for user-defined scopes.
credentials, or the passed in credentials instance if no scoping was required.
Bases: object
Interface for credentials that can cryptographically sign messages.
Signs the given message.
The signer used to sign bytes.
Bases: Enum
Tracks the state of a token. FRESH: The token is valid. It is not expired or close to expired, or the token has no expiry. STALE: The token is close to expired, and should be refreshed. The token can be used normally. INVALID: The token is expired or invalid. The token cannot be used for a normal operation.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4