Pyjo.AWS.Credentials - Credentials of AWS¶
from Pyjo.AWS.Credentials import Credentials
credentials = Credentials(access_key_id='AKIDEXAMPLE', secret_access_key='secret')
# Or import the module, as in Google Python Style Guide
import Pyjo.AWS.Credentials.Chain
# The credentials that the SDKs of AWS find, blocking
credentials = Pyjo.AWS.Credentials.Chain.new().credentials()
print(credentials.access_key_id, credentials.expiration, credentials.provider)
# Non-blocking
Pyjo.AWS.Credentials.Chain.new().credentials_p().then(lambda credentials: print(credentials.provider)).wait()
Pyjo.AWS.Credentials is the credentials of AWS that sign a request:
an access key, with the session token and the expiration of temporary
credentials. A provider of Pyjo.AWS.Credentials.Provider gets them,
as Pyjo.AWS.Credentials.Chain gets them from the places where the SDKs
of AWS find them.
See also¶
Pyjo.AWS.Credentials.Provider, Pyjo.AWS.Credentials.Chain,
Pyjo.AWS.SigV4, Pyjo.AWS.
Classes¶
- class Pyjo.AWS.Credentials.Pyjo_AWS_Credentials(*, access_key_id: str, secret_access_key: str, session_token: str | None = None, expiration: Pyjo_Date | None = None, account_id: str | None = None, provider: str | None = None)[source]¶
Pyjo.AWS.Credentialsinherits all attributes and methods fromPyjo.Baseand implements the following new ones.- __init__(*, access_key_id: str, secret_access_key: str, session_token: str | None = None, expiration: Pyjo_Date | None = None, account_id: str | None = None, provider: str | None = None) None[source]¶
credentials = Pyjo.AWS.Credentials.new(access_key_id='AKIDEXAMPLE', secret_access_key='secret')
Construct a new
Pyjo.AWS.Credentialsobject.
- __weakref__¶
list of weak references to the object
- access_key_id¶
access_key_id = credentials.access_key_id
The access key ID.
- account_id¶
account_id = credentials.account_id
The ID of the account of the credentials, where the provider knows it, or
None.
- expiration¶
expiration = credentials.expiration
The
Pyjo.Dateobject of the time when temporary credentials expire, orNonefor credentials that do not expire.
- expires_in(now: Pyjo_Date | float | None = None) float | None[source]¶
seconds = credentials.expires_in()
The number of seconds until the credentials expire, negative once they have, or
Nonefor credentials that do not expire.
- provider¶
name = credentials.provider
The name of the provider of the credentials, as
environmentorprofile, orNone.
- secret_access_key¶
secret_access_key = credentials.secret_access_key
The secret access key.
- session_token¶
session_token = credentials.session_token
The session token of temporary credentials, or
None.