Pyjo.AWS.Credentials.Environment - Credentials of the environment

from Pyjo.AWS.Credentials.Environment import Environment

credentials = Environment().credentials()

# Or import the module, as in Google Python Style Guide

import Pyjo.AWS.Credentials.Environment

credentials = Pyjo.AWS.Credentials.Environment.new().credentials()

Pyjo.AWS.Credentials.Environment is the provider of the credentials of the environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN, with AWS_CREDENTIAL_EXPIRATION and AWS_ACCOUNT_ID, as AWS Lambda, the OIDC of GitHub Actions and aws configure export-credentials set them. An empty variable is none, and an access key without its secret is an error.

See also

Pyjo.AWS.Credentials.Provider, Pyjo.AWS.Credentials.Chain.

Classes

class Pyjo.AWS.Credentials.Environment.Pyjo_AWS_Credentials_Environment(*, ua: Pyjo_UserAgent | None = None, refresh: float = 300)[source]

Pyjo.AWS.Credentials.Environment inherits all attributes and methods from Pyjo.AWS.Credentials.Provider and implements the following new ones.

async fetch() → Pyjo_AWS_Credentials | None[source]
credentials = await provider.fetch()

The credentials of the environment, or None without AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

is_fresh() → bool[source]
boolean = provider.is_fresh()

Always false, as the environment may change, and reading it costs nothing.