# 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": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "aws,boto3",
"author": "rcmdnk",
"author_email": "rcmdnk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/85/df/6ec41b2ee54ec126ad9da68a65797105de5d02fdd2a4a937d6be29c2d425/boto3_session-0.0.6.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.6",
"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": "33c68e1c21101d7e61e5d717ee2225c0b4c0a2c348ecfea060207574dd2f2b2e",
"md5": "8cd3031d52d27fabd3825d70da3fc890",
"sha256": "66ea0c982d4a3866f0a1a720cd25cadc5f78513fd3b4f49021e76314c4b0b362"
},
"downloads": -1,
"filename": "boto3_session-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8cd3031d52d27fabd3825d70da3fc890",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 7925,
"upload_time": "2023-12-28T02:10:07",
"upload_time_iso_8601": "2023-12-28T02:10:07.228935Z",
"url": "https://files.pythonhosted.org/packages/33/c6/8e1c21101d7e61e5d717ee2225c0b4c0a2c348ecfea060207574dd2f2b2e/boto3_session-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "85df6ec41b2ee54ec126ad9da68a65797105de5d02fdd2a4a937d6be29c2d425",
"md5": "38dcd2f0fcd10d01157ed008f3e6a10f",
"sha256": "6d99dfa33be333f0d9592642c00139e385f6c7abfd154848a2798660bceb3146"
},
"downloads": -1,
"filename": "boto3_session-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "38dcd2f0fcd10d01157ed008f3e6a10f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 7800,
"upload_time": "2023-12-28T02:10:09",
"upload_time_iso_8601": "2023-12-28T02:10:09.598703Z",
"url": "https://files.pythonhosted.org/packages/85/df/6ec41b2ee54ec126ad9da68a65797105de5d02fdd2a4a937d6be29c2d425/boto3_session-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-28 02:10: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"
}