handtruck.credentials¶
- class handtruck.credentials.AbstractCredentials[source]¶
Bases:
ABC- abstract property signer: AwsRequestSigner¶
- class handtruck.credentials.ConfigCredentials(credentials_path: str | Path | None = None, config_path: str | Path | None = PosixPath('/home/docs/.aws/config'), *, region: str = '', service: str = 's3', profile: str = 'auto')[source]¶
Bases:
StaticCredentialsCredentials from the awscli config
By default, these come from
~/.aws/credentialsand~/.aws/config, but this is customizable with$AWS_SHARED_CREDENTIALS_FILE,$AWS_SHARED_CONFIG_FILE, and$AWS_PROFILE.- DEFAULT_CONFIG_PATH = PosixPath('/home/docs/.aws/config')¶
- DEFAULT_CREDENTIALS_PATH = PosixPath('/home/docs/.aws/credentials')¶
- class handtruck.credentials.EnvironmentCredentials(region: str = '', service: str = 's3')[source]¶
Bases:
StaticCredentialsCredentials, read in from the standard environment variables.
- class handtruck.credentials.MetadataCredentials(*, service: str = 's3')[source]¶
Bases:
AbstractCredentials,AsyncContextManagerMixinCredentials from the AWS metadata service.
This only works inside of AWS, and unlike everything else, is dynamic and kept fresh. The context manager manages this process:
with MetadataCredentials() as creds: client = S3Client(..., credentials=creds)
- property signer: AwsRequestSigner¶
- class handtruck.credentials.StaticCredentials(access_key_id: str = '', secret_access_key: str = '', session_token: str | None = None, region: str = '', service: str = 's3')[source]¶
Bases:
AbstractCredentialsSimple, constant credentials, passed in from elsewhere.
- class handtruck.credentials.URLCredentials(url: str | URL, *, region: str = '', service: str = 's3')[source]¶
Bases:
StaticCredentialsCredentials, where the access key and secret are in the URL.
- handtruck.credentials.collect_credentials(*, url: URL | None = None, **kwargs) StaticCredentials[source]¶
Calls
merge_credentials()on the set of standard credential sources.If you want to emulate awscli, use this.
- handtruck.credentials.merge_credentials(*credentials: StaticCredentials) StaticCredentials[source]¶
Reads a bunch of credentials and produces a
StaticCredentials.