boto3-refresh-session 0.0.18__py3-none-any.whl → 0.0.21__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- boto3_refresh_session/session.py +13 -18
- {boto3_refresh_session-0.0.18.dist-info → boto3_refresh_session-0.0.21.dist-info}/METADATA +11 -2
- boto3_refresh_session-0.0.21.dist-info/RECORD +6 -0
- boto3_refresh_session-0.0.18.dist-info/RECORD +0 -6
- {boto3_refresh_session-0.0.18.dist-info → boto3_refresh_session-0.0.21.dist-info}/LICENSE +0 -0
- {boto3_refresh_session-0.0.18.dist-info → boto3_refresh_session-0.0.21.dist-info}/WHEEL +0 -0
boto3_refresh_session/session.py
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
__doc__ = """
|
4
|
-
Helper method for generating an automatically refreshing
|
4
|
+
Helper method for generating an automatically refreshing :class:`boto3.session.Session`
|
5
5
|
object.
|
6
6
|
|
7
7
|
.. warning::
|
8
8
|
``AutoRefreshableSession`` was not tested for manually passing hard-coded
|
9
|
-
account credentials to the
|
9
|
+
account credentials to the :class:`boto3.session.Session` or ``boto3.client``
|
10
10
|
objects! There are optional ``session_kwargs`` and ``client_kwargs``
|
11
11
|
parameters available for passing hard-coded account credentials, which
|
12
12
|
should work; however, that cannot be guaranteed! In any case, the ``boto3``
|
13
|
-
documentation
|
13
|
+
documentation generally recommends against passing hard-coded account credentials
|
14
14
|
as parameters; it is for that reason the documentation below, and everywhere
|
15
15
|
else, only mentions ``~/.aws/config`` and ``~/.aws/credentials`` for
|
16
|
-
authorization.
|
16
|
+
authorization. Since the ``session_kwargs`` and ``client_kwargs`` parameters
|
17
|
+
were not tested, you will need to use those parameters at your own discretion.
|
17
18
|
"""
|
18
19
|
__all__ = ["AutoRefreshableSession"]
|
19
20
|
|
@@ -28,14 +29,11 @@ from botocore.session import get_session
|
|
28
29
|
|
29
30
|
@define
|
30
31
|
class AutoRefreshableSession:
|
31
|
-
"""Returns a
|
32
|
+
"""Returns a :class:`boto3.session.Session` object which refreshes automatically, no extra
|
32
33
|
steps required.
|
33
34
|
|
34
35
|
This object is useful for long-running processes where temporary credentials
|
35
|
-
may expire
|
36
|
-
|
37
|
-
To use this class, you must have ``~/.aws/config`` or ``~/.aws/credentials``
|
38
|
-
configured on your machine.
|
36
|
+
may expire.
|
39
37
|
|
40
38
|
Parameters
|
41
39
|
----------
|
@@ -48,27 +46,24 @@ class AutoRefreshableSession:
|
|
48
46
|
ttl : int, optional
|
49
47
|
Number of seconds until temporary credentials expire, default 900.
|
50
48
|
session_kwargs : dict, optional
|
51
|
-
Optional keyword arguments for
|
49
|
+
Optional keyword arguments for :class:`boto3.session.Session`.
|
52
50
|
client_kwargs : dict, optional
|
53
|
-
Optional keyword arguments for ``boto3.
|
51
|
+
Optional keyword arguments for ``boto3.client``.
|
54
52
|
|
55
53
|
Attributes
|
56
54
|
----------
|
57
55
|
session
|
58
|
-
Returns a
|
56
|
+
Returns a :class:`boto3.session.Session` object with credentials which refresh
|
59
57
|
automatically.
|
60
58
|
|
61
59
|
Notes
|
62
60
|
-----
|
63
|
-
|
64
|
-
|
65
|
-
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
|
66
|
-
|
67
|
-
This class assumes that ``~/.aws`` exists with ``/config`` or ``/credentials``!
|
61
|
+
Check the :ref:`authorization documentation <authorization>` for additional
|
62
|
+
information concerning how to authorize access to AWS.
|
68
63
|
|
69
64
|
Examples
|
70
65
|
--------
|
71
|
-
Here's how to initialize
|
66
|
+
Here's how to initialize this object:
|
72
67
|
|
73
68
|
>>> sess = AutoRefreshableSession(
|
74
69
|
>>> region="us-east-1",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: boto3-refresh-session
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.21
|
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
|
@@ -73,7 +73,10 @@ To use this package, your machine must be configured with AWS
|
|
73
73
|
credentials. To learn more about how `boto3` searches for credentials on a
|
74
74
|
machine, check [this documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html).
|
75
75
|
|
76
|
-
```
|
76
|
+
```python
|
77
|
+
from boto3_refresh_session import AutoRefreshableSession
|
78
|
+
|
79
|
+
|
77
80
|
sess = AutoRefreshableSession(
|
78
81
|
region="<your-region>",
|
79
82
|
role_arn="<your-role-arn>",
|
@@ -82,6 +85,12 @@ sess = AutoRefreshableSession(
|
|
82
85
|
s3_client = sess.session.client(service_name="s3")
|
83
86
|
```
|
84
87
|
|
88
|
+
### Installation
|
89
|
+
|
90
|
+
```bash
|
91
|
+
pip install boto3-refresh-session
|
92
|
+
```
|
93
|
+
|
85
94
|
### Authors
|
86
95
|
|
87
96
|
- [Michael Letts](https://michaelthomasletts.github.io/)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
boto3_refresh_session/__init__.py,sha256=OMY8el4qROyEvo0vr1Kv8rtFU7g3xnjHuBss54XRTEA,135
|
2
|
+
boto3_refresh_session/session.py,sha256=3bzw-zs_5TXmJsFJSSV8ENpPK3XrItvCuU2otVKn8X8,4489
|
3
|
+
boto3_refresh_session-0.0.21.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
4
|
+
boto3_refresh_session-0.0.21.dist-info/METADATA,sha256=eNGmHlSIeXhl-tO5vyu33VaHXbXKm9WduO8S8KrhHmQ,4007
|
5
|
+
boto3_refresh_session-0.0.21.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
6
|
+
boto3_refresh_session-0.0.21.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
boto3_refresh_session/__init__.py,sha256=OMY8el4qROyEvo0vr1Kv8rtFU7g3xnjHuBss54XRTEA,135
|
2
|
-
boto3_refresh_session/session.py,sha256=KeaQ7kfIZtJqF5rdZNJu7ASvxWX03oRDwjFyw82haeA,4545
|
3
|
-
boto3_refresh_session-0.0.18.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
4
|
-
boto3_refresh_session-0.0.18.dist-info/METADATA,sha256=hZHbtCX66fKIlAc-zc60DN7Q4Mt4Ws4o2lZw5LA1uZo,3877
|
5
|
-
boto3_refresh_session-0.0.18.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
6
|
-
boto3_refresh_session-0.0.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|