boto3-session
A wrapper library for the boto3.session.Session class in Python.
Requirement
- Python versions >=3.9
- uv (for development purposes)
Installation
To install boto3-session, run the following command:
$ pip install boto3-session
Usage
boto3_session.Session can be used similarly to boto3.Session:
from boto3_session import Session
session = Session()
s3 = session.resource('s3')
bucket = s3.Bucket(...)
...
The some of parameters for boto3_session.Session are akin to those for boto3.Session:
profile_name: The AWS profile name.aws_access_key_id: The AWS access key ID.aws_secret_access_key: The AWS secret access key.aws_session_token: The AWS session token.region_name: The AWS region name.
Additionally, boto3_session.Session supports management of AssumeRole:
role_arn: The AWS role ARN for AssumeRole. If set, aws_access_key_id, aws_secret_access_key, and aws_session_token are replaced with the AssumeRole credentials.session_name: The AWS session name, defaulting to "boto3_session".
boto3_session.Session includes client and resource methods, like boto3.Session. By default, the following configuration is passed to them:
Config(retries={'max_attempts': self.max_attempts, 'mode': self.retry_mode})
In boto3, the default values for max_attempts and mode are 5 and legacy, respectively. In boto3_session, they default to 3 and "standard".
These defaults can be overridden by passing the following parameters to boto3_session.Session:
retry_mode: The retry mode for failed requests, defaulting to "standard".max_attempts: The maximum number of retry attempts for failed requests, defaulting to 10.
For SSO login:
use_device_code: A boolean flag to force the use of the device authorization flow for SSO login. Defaults to False.
See the next section for details.
SSO Login
For configurations with SSO login, if the token is absent or expired,
boto3_session.Session automatically orchestrates an IAM Identity Center login
flow. By default the library re-implements the AWS CLI v2 PKCE authorization
code flow (version 2.22.0 and newer) and opens the one-time verification URL in
your browser. If the interactive flow cannot run for some reason, it falls
back to invoking aws sso login.
If you need to force the older device authorization flow (for example when the
browser-based PKCE flow is not available), set the use_device_code flag when
creating the session:
Session(use_device_code=True)
This mirrors the --use-device-code option introduced in modern AWS CLI
releases.
Metadata
Release files for boto3-session 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| boto3_session-0.2.2.tar.gz | 9.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| boto3_session-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.0 kB
Release files / boto3_session-0.2.2.tar.gz
| Download URL | boto3_session-0.2.2.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52a28a00611ebef41669f794df227cf2ebac205883b262ccd24656fbdc675189
|
|
BLAKE2b-256 checksum How to use checksums |
5782372e52e9ffa1a9a0097bbb79454ccd14c1f996ecc4e062e963fd54843932
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / boto3_session-0.2.2-py3-none-any.whl
| Download URL | boto3_session-0.2.2-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
535f5b3ebccc49c8a7c67213fc7300bd72fee48c85b99018109960beb30d3975
|
|
BLAKE2b-256 checksum How to use checksums |
ea0f060f8014f89de3943b6dcae880c1a9620f0a492094b6791c2a28d432139d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Security for boto3-session 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.