boto3-session


Nameboto3-session JSON
Version 0.0.9 PyPI version JSON
download
home_pageNone
SummaryWrapper library for python boto3.session.Session.
upload_time2025-08-08 10:34:09
maintainerNone
docs_urlNone
authorrcmdnk
requires_python>=3.9
licenseNone
keywords aws boto3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # boto3-session

[![test](https://github.com/rcmdnk/boto3-session/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/boto3-session/actions/workflows/test.yml)
[![test coverage](https://img.shields.io/badge/coverage-check%20here-blue.svg)](https://github.com/rcmdnk/boto3-session/tree/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:

```bash
$ pip install boto3-session
```

## Usage

boto3_session.Session can be used similarly to boto3.Session:

```python
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:

```python
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.

- [Install or update the latest version of the AWS CLI - AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
  Install or update the latest version of the AWS CLI - AWS Command Line Interface

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "boto3-session",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "aws, boto3",
    "author": "rcmdnk",
    "author_email": "rcmdnk <rcmdnk@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/62/7b/c0d8218893e600dabd2b0d9cfedc2d147fe821519a8ed48466105a14fbb0/boto3_session-0.0.9.tar.gz",
    "platform": null,
    "description": "# boto3-session\n\n[![test](https://github.com/rcmdnk/boto3-session/actions/workflows/test.yml/badge.svg)](https://github.com/rcmdnk/boto3-session/actions/workflows/test.yml)\n[![test coverage](https://img.shields.io/badge/coverage-check%20here-blue.svg)](https://github.com/rcmdnk/boto3-session/tree/coverage)\n\nA wrapper library for the boto3.session.Session class in Python.\n\n## Requirement\n\n- Python versions 3.9, 3.10, 3.11, 3.12\n- Poetry (for development purposes)\n\n## Installation\n\nTo install boto3-session, run the following command:\n\n```bash\n$ pip install boto3-session\n```\n\n## Usage\n\nboto3_session.Session can be used similarly to boto3.Session:\n\n```python\nfrom boto3_session import Session\n\nsession = Session()\ns3 = session.resource(\"s3\")\nbucket = s3.Bucket(...)\n...\n```\n\nThe some of parameters for boto3_session.Session are akin to those for boto3.Session:\n\n- `profile_name`: The AWS profile name.\n- `aws_access_key_id`: The AWS access key ID.\n- `aws_secret_access_key`: The AWS secret access key.\n- `aws_session_token`: The AWS session token.\n- `region_name`: The AWS region name.\n\nAdditionally, boto3_session.Session supports management of AssumeRole:\n\n- `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.\n- `session_name`: The AWS session name, defaulting to \"boto3_session\".\n\nboto3_session.Session includes `client` and `resource` methods, like boto3.Session. By default, the following configuration is passed to them:\n\n```python\nConfig(retries={\"max_attempts\": self.max_attempts, \"mode\": self.retry_mode})\n```\n\nIn boto3, the default values for `max_attempts` and `mode` are 5 and legacy, respectively. In boto3_session, they default to 3 and \"standard\".\n\nThese defaults can be overridden by passing the following parameters to boto3_session.Session:\n\n- `retry_mode`: The retry mode for failed requests, defaulting to \"standard\".\n- `max_attempts`: The maximum number of retry attempts for failed requests, defaulting to 10.\n\n## SSO Login\n\nFor configurations with SSO login, if the token is absent or expired, boto3_session.Session automatically executes aws sso login.\n\nNote: The aws command-line tool must be installed.\n\n- [Install or update the latest version of the AWS CLI - AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n  Install or update the latest version of the AWS CLI - AWS Command Line Interface\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Wrapper library for python boto3.session.Session.",
    "version": "0.0.9",
    "project_urls": {
        "Documentation": "https://github.com/rcmdnk/boto3-session",
        "Homepage": "https://github.com/rcmdnk/boto3-session",
        "Issue": "https://github.com/rcmdnk/boto3-session/ssues",
        "Repository": "https://github.com/rcmdnk/boto3-session"
    },
    "split_keywords": [
        "aws",
        " boto3"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c5ed9129e358578833aeea1e0c77b2f2ddb04937a7bdd01720a9b65c57970e33",
                "md5": "374e2e59dafb59d9c6ed1a47c20af1d3",
                "sha256": "ecc348065038abf8fd95f41ba35038c30d740d36e74642eb8ace2e7c6e96d911"
            },
            "downloads": -1,
            "filename": "boto3_session-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "374e2e59dafb59d9c6ed1a47c20af1d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4270,
            "upload_time": "2025-08-08T10:34:07",
            "upload_time_iso_8601": "2025-08-08T10:34:07.653312Z",
            "url": "https://files.pythonhosted.org/packages/c5/ed/9129e358578833aeea1e0c77b2f2ddb04937a7bdd01720a9b65c57970e33/boto3_session-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "627bc0d8218893e600dabd2b0d9cfedc2d147fe821519a8ed48466105a14fbb0",
                "md5": "969f5cf0d075e61e532b0694f9d878a1",
                "sha256": "cd39dcec52e1321ff335e6c52b6f4d5e1c5efb0a12f76933fe26e2d179c4be41"
            },
            "downloads": -1,
            "filename": "boto3_session-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "969f5cf0d075e61e532b0694f9d878a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 4342,
            "upload_time": "2025-08-08T10:34:09",
            "upload_time_iso_8601": "2025-08-08T10:34:09.094538Z",
            "url": "https://files.pythonhosted.org/packages/62/7b/c0d8218893e600dabd2b0d9cfedc2d147fe821519a8ed48466105a14fbb0/boto3_session-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-08 10:34:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rcmdnk",
    "github_project": "boto3-session",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "boto3-session"
}
        
Elapsed time: 2.58483s