boto3-refresh-session 0.0.25__py3-none-any.whl → 0.0.27__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 :class:`boto3.session.Session` or ``boto3.client``
10
- objects! There are optional ``session_kwargs`` and ``client_kwargs``
11
- parameters available for passing hard-coded account credentials, which
12
- should work; however, that cannot be guaranteed! In any case, the ``boto3``
13
- documentation generally recommends against passing hard-coded account credentials
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(botocore_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
- __session = Session(region_name=self.region, **self.session_kwargs)
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 = __client.assume_role(
130
+ __temporary_credentials = __sts_client.assume_role(
134
131
  RoleArn=self.role_arn,
135
132
  RoleSessionName=self.session_name,
136
133
  DurationSeconds=self.ttl,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3-refresh-session
3
- Version: 0.0.25
3
+ Version: 0.0.27
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
@@ -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,,