# 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": "https://github.com/rcmdnk/boto3-session",
"name": "boto3-session",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "aws, boto3",
"author": "rcmdnk",
"author_email": "rcmdnk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/45/72/09b7a3d6655c49f8bdd05d2c864aaaccd577d91bc3e79e759778b1e2138a/boto3_session-0.0.8.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": "Apache-2.0",
"summary": "Wrapper library for python boto3.session.Session.",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/rcmdnk/boto3-session",
"Repository": "https://github.com/rcmdnk/boto3-session"
},
"split_keywords": [
"aws",
" boto3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c22a305024e8f81c9b17fce0e0969d91ec6ffaf934641da032b8b98292f0789e",
"md5": "c4d9489c0c6e416531ccb3db05c6aece",
"sha256": "a7e4c26b4081737a3d3984f41c3d4964dbe502c044777ad503ee18f53aaa66b5"
},
"downloads": -1,
"filename": "boto3_session-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c4d9489c0c6e416531ccb3db05c6aece",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 8116,
"upload_time": "2024-11-05T16:45:27",
"upload_time_iso_8601": "2024-11-05T16:45:27.358209Z",
"url": "https://files.pythonhosted.org/packages/c2/2a/305024e8f81c9b17fce0e0969d91ec6ffaf934641da032b8b98292f0789e/boto3_session-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "457209b7a3d6655c49f8bdd05d2c864aaaccd577d91bc3e79e759778b1e2138a",
"md5": "27bddf97ac6e2b680552d61d5f5746ae",
"sha256": "fc008b69971c904514c695d4eab535efba1cba2bf81b9f808563f7e39a440b80"
},
"downloads": -1,
"filename": "boto3_session-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "27bddf97ac6e2b680552d61d5f5746ae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 7870,
"upload_time": "2024-11-05T16:45:29",
"upload_time_iso_8601": "2024-11-05T16:45:29.058204Z",
"url": "https://files.pythonhosted.org/packages/45/72/09b7a3d6655c49f8bdd05d2c864aaaccd577d91bc3e79e759778b1e2138a/boto3_session-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-05 16:45:29",
"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"
}