Skip to main content

Wrapper library for python boto3.session.Session.

Project description

boto3-session

test test coverage

A wrapper library for the boto3.session.Session class in Python.

Requirement

  • Python versions 3.9, 3.10, 3.11, 3.12
  • Poetry (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.

SSO Login

For configurations with SSO login, if the token is absent or expired, boto3_session.Session automatically executes aws sso login.

Note: The aws command-line tool must be installed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boto3_session-0.0.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boto3_session-0.0.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file boto3_session-0.0.2.tar.gz.

File metadata

  • Download URL: boto3_session-0.0.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

File hashes

Hashes for boto3_session-0.0.2.tar.gz
Algorithm Hash digest
SHA256 358d110165968baeb9fb55e5dd83e9de4d536f5da148baac4f925e67601c73bc
MD5 b09b2c4a123d29b25ce6965f181614e9
BLAKE2b-256 8c0f653e823993ab15c49a4ed6c68566807d49593b1c91c6eedbf9d131543a38

See more details on using hashes here.

File details

Details for the file boto3_session-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: boto3_session-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

File hashes

Hashes for boto3_session-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f879efdb147af9ea1f901f4c374de986b202aa05a9a96d1364f5ecf69cdb0f66
MD5 e9f6986c81519ce417cd56f2732750c7
BLAKE2b-256 95c34bc215f378824a766e4b823dbfb2e4bc713c8c9bdcb787ad90b1ce7e071a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page