boto3-refresh-session 0.0.11__py3-none-any.whl → 0.0.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- boto3_refresh_session/session.py +13 -21
- {boto3_refresh_session-0.0.11.dist-info → boto3_refresh_session-0.0.12.dist-info}/METADATA +2 -39
- boto3_refresh_session-0.0.12.dist-info/RECORD +6 -0
- boto3_refresh_session-0.0.11.dist-info/RECORD +0 -6
- {boto3_refresh_session-0.0.11.dist-info → boto3_refresh_session-0.0.12.dist-info}/LICENSE +0 -0
- {boto3_refresh_session-0.0.11.dist-info → boto3_refresh_session-0.0.12.dist-info}/WHEEL +0 -0
boto3_refresh_session/session.py
CHANGED
@@ -1,17 +1,9 @@
|
|
1
|
-
"""
|
2
|
-
Helper method for generating an automatically refreshing `boto3.Session`
|
3
|
-
object.
|
4
|
-
|
5
|
-
.. currentmodule:: boto3_refresh_session.session
|
6
|
-
|
7
|
-
.. autosummary::
|
8
|
-
:toctree: session/
|
9
|
-
|
10
|
-
AutoRefreshableSession
|
11
|
-
"""
|
12
|
-
|
13
1
|
from __future__ import annotations
|
14
2
|
|
3
|
+
__doc__ = """
|
4
|
+
Helper method for generating an automatically refreshing ``boto3.Session``
|
5
|
+
object.
|
6
|
+
"""
|
15
7
|
__all__ = ["AutoRefreshableSession"]
|
16
8
|
|
17
9
|
from typing import Type
|
@@ -25,14 +17,14 @@ from botocore.session import get_session
|
|
25
17
|
|
26
18
|
@define
|
27
19
|
class AutoRefreshableSession:
|
28
|
-
"""Returns a boto3
|
20
|
+
"""Returns a ``boto3.Session`` object which refreshes automatically, no extra
|
29
21
|
steps required.
|
30
22
|
|
31
23
|
This object is useful for long-running processes where temporary credentials
|
32
24
|
may expire between iterations.
|
33
25
|
|
34
|
-
To use this class, you must have
|
35
|
-
on your machine.
|
26
|
+
To use this class, you must have ``~/.aws/config`` or ``~/.aws/credentials``
|
27
|
+
configured on your machine.
|
36
28
|
|
37
29
|
Parameters
|
38
30
|
----------
|
@@ -45,14 +37,14 @@ class AutoRefreshableSession:
|
|
45
37
|
ttl : int, optional
|
46
38
|
Number of seconds until temporary credentials expire, default 900.
|
47
39
|
session_kwargs : dict, optional
|
48
|
-
Optional keyword arguments for
|
40
|
+
Optional keyword arguments for ``boto3.Session``.
|
49
41
|
client_kwargs : dict, optional
|
50
|
-
Optional keyword arguments for
|
42
|
+
Optional keyword arguments for ``boto3.Session.client``.
|
51
43
|
|
52
44
|
Attributes
|
53
45
|
----------
|
54
46
|
session
|
55
|
-
Returns a boto3
|
47
|
+
Returns a ``boto3.Session`` object with credentials which refresh
|
56
48
|
automatically.
|
57
49
|
|
58
50
|
Notes
|
@@ -61,13 +53,13 @@ class AutoRefreshableSession:
|
|
61
53
|
|
62
54
|
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
|
63
55
|
|
64
|
-
This class assumes that
|
56
|
+
This class assumes that ``~/.aws`` exists with ``/config`` or ``/credentials``!
|
65
57
|
|
66
58
|
Examples
|
67
59
|
--------
|
68
|
-
Here's how to initialize the
|
60
|
+
Here's how to initialize the ``boto3.Client.S3`` object:
|
69
61
|
|
70
|
-
>>>
|
62
|
+
>>> sess = AutoRefreshableSession(
|
71
63
|
>>> region="us-east-1",
|
72
64
|
>>> role_arn="<your-arn>",
|
73
65
|
>>> session_name="test",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: boto3-refresh-session
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.12
|
4
4
|
Summary: A simple Python package for refreshing boto3 sessions automatically.
|
5
5
|
Home-page: https://github.com/michaelthomasletts/boto3-refresh-session
|
6
6
|
License: MIT
|
@@ -32,43 +32,6 @@ Description-Content-Type: text/markdown
|
|
32
32
|
|
33
33
|
A simple Python package for refreshing boto3 sessions automatically.
|
34
34
|
|
35
|
-
##
|
35
|
+
## Usage and Installation
|
36
36
|
|
37
37
|
[Official Documentation](https://michaelthomasletts.github.io/boto3-refresh-session/index.html)
|
38
|
-
|
39
|
-
## Features
|
40
|
-
- `boto3_refresh_session.AutoRefreshableSession` method for generating an automatically refreshing `boto3.Session` object.
|
41
|
-
|
42
|
-
## Installation
|
43
|
-
|
44
|
-
To install the package using `pip`:
|
45
|
-
|
46
|
-
```bash
|
47
|
-
$ pip install boto3-refresh-session
|
48
|
-
```
|
49
|
-
|
50
|
-
**This package assumes that you have `~/.aws/config` or `~/.aws/credentials` files or `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables configured on your machine!**
|
51
|
-
|
52
|
-
Refer to the [boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html) for additional details about configuring those credentials on your machine.
|
53
|
-
|
54
|
-
## Directory
|
55
|
-
|
56
|
-
```
|
57
|
-
boto3_refresh_session
|
58
|
-
├── __init__.py
|
59
|
-
└── session.py
|
60
|
-
```
|
61
|
-
|
62
|
-
## Usage
|
63
|
-
|
64
|
-
Here's how to initialize the `boto3.Client.S3` object:
|
65
|
-
|
66
|
-
```python
|
67
|
-
from boto3_refresh_session import AutoRefreshableSession
|
68
|
-
|
69
|
-
|
70
|
-
session = AutoRefreshableSession(
|
71
|
-
region="us-east-1", role_arn="<your-arn>", session_name="test"
|
72
|
-
)
|
73
|
-
s3_client = session.session.client(service_name="s3")
|
74
|
-
```
|
@@ -0,0 +1,6 @@
|
|
1
|
+
boto3_refresh_session/__init__.py,sha256=OMY8el4qROyEvo0vr1Kv8rtFU7g3xnjHuBss54XRTEA,135
|
2
|
+
boto3_refresh_session/session.py,sha256=bxYzA6YaAtLqFEtq5G-zXcEqc3HHAnY84rAJe0snfhg,3896
|
3
|
+
boto3_refresh_session-0.0.12.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
4
|
+
boto3_refresh_session-0.0.12.dist-info/METADATA,sha256=eNTbNYA7iItKdNakJSJi_ECYE3jAhDaSFabeZhF3iOg,1718
|
5
|
+
boto3_refresh_session-0.0.12.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
6
|
+
boto3_refresh_session-0.0.12.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
boto3_refresh_session/__init__.py,sha256=OMY8el4qROyEvo0vr1Kv8rtFU7g3xnjHuBss54XRTEA,135
|
2
|
-
boto3_refresh_session/session.py,sha256=4AxunP-eQtjyT2NbTnC8elgMDcPlMY55LDrSE1XPKgY,3972
|
3
|
-
boto3_refresh_session-0.0.11.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
4
|
-
boto3_refresh_session-0.0.11.dist-info/METADATA,sha256=wj79tsjK3BcthjKOdlEzNxpF4p0gNoEY_-ZUlp6OCaI,2705
|
5
|
-
boto3_refresh_session-0.0.11.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
6
|
-
boto3_refresh_session-0.0.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|