boto3-refresh-session 0.0.25__py3-none-any.whl → 0.0.27__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 +11 -14
- {boto3_refresh_session-0.0.25.dist-info → boto3_refresh_session-0.0.27.dist-info}/METADATA +1 -1
- boto3_refresh_session-0.0.27.dist-info/RECORD +6 -0
- boto3_refresh_session-0.0.25.dist-info/RECORD +0 -6
- {boto3_refresh_session-0.0.25.dist-info → boto3_refresh_session-0.0.27.dist-info}/LICENSE +0 -0
- {boto3_refresh_session-0.0.25.dist-info → boto3_refresh_session-0.0.27.dist-info}/WHEEL +0 -0
boto3_refresh_session/session.py
CHANGED
@@ -6,15 +6,11 @@ object.
|
|
6
6
|
|
7
7
|
.. warning::
|
8
8
|
``AutoRefreshableSession`` was not tested for manually passing hard-coded
|
9
|
-
account credentials to the
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
as parameters; it is for that reason the documentation below, and everywhere
|
15
|
-
else, only mentions ``~/.aws/config`` and ``~/.aws/credentials`` for
|
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.
|
9
|
+
account credentials to the ``boto3.client`` object! There is an optional
|
10
|
+
``client_kwargs`` parameter available for doing so, which *should* work;
|
11
|
+
however, that cannot be guaranteed as that functionality was not tested.
|
12
|
+
Pass hard-coded credentials with the ``client_kwargs`` parameter at your
|
13
|
+
own discretion.
|
18
14
|
"""
|
19
15
|
__all__ = ["AutoRefreshableSession"]
|
20
16
|
|
@@ -22,7 +18,7 @@ from typing import Type
|
|
22
18
|
|
23
19
|
from attrs import define, field
|
24
20
|
from attrs.validators import ge, instance_of, optional
|
25
|
-
from boto3 import Session
|
21
|
+
from boto3 import Session, client
|
26
22
|
from botocore.credentials import (
|
27
23
|
DeferredRefreshableCredentials,
|
28
24
|
RefreshableCredentials,
|
@@ -115,7 +111,9 @@ class AutoRefreshableSession:
|
|
115
111
|
)
|
116
112
|
|
117
113
|
__session._credentials = __credentials
|
118
|
-
self.session = Session(
|
114
|
+
self.session = Session(
|
115
|
+
botocore_session=__session, **self.session_kwargs
|
116
|
+
)
|
119
117
|
|
120
118
|
def _get_credentials(self) -> dict:
|
121
119
|
"""Returns temporary credentials via AWS STS.
|
@@ -126,11 +124,10 @@ class AutoRefreshableSession:
|
|
126
124
|
AWS temporary credentials.
|
127
125
|
"""
|
128
126
|
|
129
|
-
|
130
|
-
__client = __session.client(
|
127
|
+
__sts_client = client(
|
131
128
|
service_name="sts", region_name=self.region, **self.client_kwargs
|
132
129
|
)
|
133
|
-
__temporary_credentials =
|
130
|
+
__temporary_credentials = __sts_client.assume_role(
|
134
131
|
RoleArn=self.role_arn,
|
135
132
|
RoleSessionName=self.session_name,
|
136
133
|
DurationSeconds=self.ttl,
|
@@ -0,0 +1,6 @@
|
|
1
|
+
boto3_refresh_session/__init__.py,sha256=OMY8el4qROyEvo0vr1Kv8rtFU7g3xnjHuBss54XRTEA,135
|
2
|
+
boto3_refresh_session/session.py,sha256=565FIz_PW8jTptvWooMEuS7igvWxWCjejBC500erUwU,4880
|
3
|
+
boto3_refresh_session-0.0.27.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
4
|
+
boto3_refresh_session-0.0.27.dist-info/METADATA,sha256=fg1Q7M3TtH95u0oigOtbvosqre6BzyOKucE87y_th3s,4472
|
5
|
+
boto3_refresh_session-0.0.27.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
6
|
+
boto3_refresh_session-0.0.27.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
boto3_refresh_session/__init__.py,sha256=OMY8el4qROyEvo0vr1Kv8rtFU7g3xnjHuBss54XRTEA,135
|
2
|
-
boto3_refresh_session/session.py,sha256=nrUQRTGmXJGKvUJbr0nw56lx9Ww3BlDy8ceOoFBA6O0,5292
|
3
|
-
boto3_refresh_session-0.0.25.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
4
|
-
boto3_refresh_session-0.0.25.dist-info/METADATA,sha256=SD2bxPQOrIdvBvxNLrJNWMYHEuA7siG2d_gx7ozbNIA,4472
|
5
|
-
boto3_refresh_session-0.0.25.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
6
|
-
boto3_refresh_session-0.0.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|