boto3-refresh-session 0.0.25__tar.gz → 0.0.27__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/PKG-INFO +1 -1
- {boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/boto3_refresh_session/session.py +11 -14
- {boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/pyproject.toml +1 -1
- {boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/LICENSE +0 -0
- {boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/README.md +0 -0
- {boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/boto3_refresh_session/__init__.py +0 -0
{boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/boto3_refresh_session/session.py
RENAMED
@@ -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,
|
File without changes
|
File without changes
|
{boto3_refresh_session-0.0.25 → boto3_refresh_session-0.0.27}/boto3_refresh_session/__init__.py
RENAMED
File without changes
|