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.Credentials inherits all attributes and methods from Pyjo.Base and 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.Credentials object.

__repr__() → str[source]

Return repr(self).

__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.Date object of the time when temporary credentials expire, or None for 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 None for credentials that do not expire.

provider
name = credentials.provider

The name of the provider of the credentials, as environment or profile, or None.

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.

Pyjo.AWS.Credentials.parse_time(value: str) → Pyjo_Date[source]
expiration = Pyjo.AWS.Credentials.parse_time('2026-11-03T12:00:00Z')

A Pyjo.Date object of a time of RFC 3339, as the expiration of credentials, in UTC when it has no time zone.