boto3-refresh-session 1.3.14__py3-none-any.whl → 1.3.16__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.
@@ -4,7 +4,7 @@ from .session import RefreshableSession
4
4
  from .sts import STSRefreshableSession
5
5
 
6
6
  __all__ = ["RefreshableSession"]
7
- __version__ = "1.3.14"
7
+ __version__ = "1.3.16"
8
8
  __title__ = "boto3-refresh-session"
9
9
  __author__ = "Mike Letts"
10
10
  __maintainer__ = "Mike Letts"
@@ -9,33 +9,36 @@ from .session import BaseRefreshableSession
9
9
 
10
10
 
11
11
  class CustomRefreshableSession(BaseRefreshableSession, method="custom"):
12
- """A :class:`boto3.session.Session` object that automatically refreshes temporary credentials
13
- returned by a custom credential getter provided by the user. Useful for users with highly
14
- sophisticated or idiosyncratic authentication flows.
12
+ """A :class:`boto3.session.Session` object that automatically refreshes
13
+ temporary credentials returned by a custom credential getter provided
14
+ by the user. Useful for users with highly sophisticated or idiosyncratic
15
+ authentication flows.
15
16
 
16
17
  Parameters
17
18
  ----------
18
19
  custom_credentials_method: Callable
19
- Required. Accepts a callable object that returns temporary AWS security credentials. That
20
- object must return a dictionary containing 'access_key', 'secret_key', 'token', and
21
- 'expiry_time' when called.
20
+ Required. Accepts a callable object that returns temporary AWS
21
+ security credentials. That object must return a dictionary containing
22
+ 'access_key', 'secret_key', 'token', and 'expiry_time' when called.
22
23
  custom_credentials_method_args : dict[str, Any], optional
23
- Optional keyword arguments for the function passed to the ``custom_credentials_method``
24
- parameter.
24
+ Optional keyword arguments for the function passed to the
25
+ ``custom_credentials_method`` parameter.
25
26
  defer_refresh : bool, optional
26
- If ``True`` then temporary credentials are not automatically refreshed until
27
- they are explicitly needed. If ``False`` then temporary credentials refresh
28
- immediately upon expiration. It is highly recommended that you use ``True``.
29
- Default is ``True``.
27
+ If ``True`` then temporary credentials are not automatically refreshed
28
+ until they are explicitly needed. If ``False`` then temporary
29
+ credentials refresh immediately upon expiration. It is highly
30
+ recommended that you use ``True``. Default is ``True``.
30
31
 
31
32
  Other Parameters
32
33
  ----------------
33
34
  kwargs : dict
34
- Optional keyword arguments for the :class:`boto3.session.Session` object.
35
+ Optional keyword arguments for the :class:`boto3.session.Session`
36
+ object.
35
37
 
36
38
  Examples
37
39
  --------
38
- Write (or import) the callable object for obtaining temporary AWS security credentials.
40
+ Write (or import) the callable object for obtaining temporary AWS security
41
+ credentials.
39
42
 
40
43
  >>> def your_custom_credential_getter(your_param, another_param):
41
44
  >>> ...
@@ -85,7 +88,8 @@ class CustomRefreshableSession(BaseRefreshableSession, method="custom"):
85
88
 
86
89
  if missing := required_keys - credentials.keys():
87
90
  raise BRSError(
88
- f"The dict returned by custom_credentials_method is missing these key-value pairs: "
91
+ f"The dict returned by custom_credentials_method is missing "
92
+ "these key-value pairs: "
89
93
  f"{', '.join(repr(param) for param in missing)}. "
90
94
  )
91
95
 
@@ -22,10 +22,10 @@ class ECSRefreshableSession(BaseRefreshableSession, method="ecs"):
22
22
  Parameters
23
23
  ----------
24
24
  defer_refresh : bool, optional
25
- If ``True`` then temporary credentials are not automatically refreshed until
26
- they are explicitly needed. If ``False`` then temporary credentials refresh
27
- immediately upon expiration. It is highly recommended that you use ``True``.
28
- Default is ``True``.
25
+ If ``True`` then temporary credentials are not automatically
26
+ refreshed until they are explicitly needed. If ``False`` then
27
+ temporary credentials refresh immediately upon expiration. It
28
+ is highly recommended that you use ``True``. Default is ``True``.
29
29
 
30
30
  Other Parameters
31
31
  ----------------
@@ -107,26 +107,29 @@ class BaseRefreshableSession(ABC, Session):
107
107
 
108
108
 
109
109
  class RefreshableSession:
110
- """Factory class for constructing refreshable boto3 sessions using various authentication
111
- methods, e.g. STS.
110
+ """Factory class for constructing refreshable boto3 sessions using various
111
+ authentication methods, e.g. STS.
112
112
 
113
- This class provides a unified interface for creating boto3 sessions whose credentials are
114
- automatically refreshed in the background.
113
+ This class provides a unified interface for creating boto3 sessions whose
114
+ credentials are automatically refreshed in the background.
115
115
 
116
- Use ``RefreshableSession(method="...")`` to construct an instance using the desired method.
116
+ Use ``RefreshableSession(method="...")`` to construct an instance using
117
+ the desired method.
117
118
 
118
- For additional information on required parameters, refer to the See Also section below.
119
+ For additional information on required parameters, refer to the See Also
120
+ section below.
119
121
 
120
122
  Parameters
121
123
  ----------
122
124
  method : Method
123
- The authentication and refresh method to use for the session. Must match a registered method name.
124
- Default is "sts".
125
+ The authentication and refresh method to use for the session. Must
126
+ match a registered method name. Default is "sts".
125
127
 
126
128
  Other Parameters
127
129
  ----------------
128
130
  **kwargs : dict
129
- Additional keyword arguments forwarded to the constructor of the selected session class.
131
+ Additional keyword arguments forwarded to the constructor of the
132
+ selected session class.
130
133
 
131
134
  See Also
132
135
  --------
@@ -140,7 +143,8 @@ class RefreshableSession:
140
143
  ) -> BaseRefreshableSession:
141
144
  if method not in (methods := cls.get_available_methods()):
142
145
  raise BRSError(
143
- f"{repr(method)} is an invalid method parameter. Available methods are "
146
+ f"{repr(method)} is an invalid method parameter. "
147
+ "Available methods are "
144
148
  f"{', '.join(repr(meth) for meth in methods)}."
145
149
  )
146
150
 
@@ -154,7 +158,8 @@ class RefreshableSession:
154
158
  Returns
155
159
  -------
156
160
  list[str]
157
- A list of all currently available credential refresh methods, e.g. 'sts'.
161
+ A list of all currently available credential refresh methods,
162
+ e.g. 'sts'.
158
163
  """
159
164
 
160
165
  return list(get_args(Method))
@@ -9,26 +9,29 @@ from .session import BaseRefreshableSession
9
9
 
10
10
 
11
11
  class STSRefreshableSession(BaseRefreshableSession, method="sts"):
12
- """A :class:`boto3.session.Session` object that automatically refreshes temporary AWS
13
- credentials using an IAM role that is assumed via STS.
12
+ """A :class:`boto3.session.Session` object that automatically refreshes
13
+ temporary AWS credentials using an IAM role that is assumed via STS.
14
14
 
15
15
  Parameters
16
16
  ----------
17
17
  assume_role_kwargs : dict
18
- Required keyword arguments for :meth:`STS.Client.assume_role` (i.e. boto3 STS client).
18
+ Required keyword arguments for :meth:`STS.Client.assume_role` (i.e.
19
+ boto3 STS client).
19
20
  defer_refresh : bool, optional
20
- If ``True`` then temporary credentials are not automatically refreshed until
21
- they are explicitly needed. If ``False`` then temporary credentials refresh
22
- immediately upon expiration. It is highly recommended that you use ``True``.
23
- Default is ``True``.
21
+ If ``True`` then temporary credentials are not automatically refreshed
22
+ until they are explicitly needed. If ``False`` then temporary
23
+ credentials refresh immediately upon expiration. It is highly
24
+ recommended that you use ``True``. Default is ``True``.
24
25
  sts_client_kwargs : dict, optional
25
- Optional keyword arguments for the :class:`STS.Client` object. Do not provide
26
- values for ``service_name`` as they are unnecessary. Default is None.
26
+ Optional keyword arguments for the :class:`STS.Client` object. Do not
27
+ provide values for ``service_name`` as they are unnecessary. Default
28
+ is None.
27
29
 
28
30
  Other Parameters
29
31
  ----------------
30
32
  kwargs : dict
31
- Optional keyword arguments for the :class:`boto3.session.Session` object.
33
+ Optional keyword arguments for the :class:`boto3.session.Session`
34
+ object.
32
35
  """
33
36
 
34
37
  def __init__(
@@ -43,10 +46,11 @@ class STSRefreshableSession(BaseRefreshableSession, method="sts"):
43
46
  self.assume_role_kwargs = assume_role_kwargs
44
47
 
45
48
  if sts_client_kwargs is not None:
46
- # overwriting 'service_name' in case it appears in sts_client_kwargs
49
+ # overwriting 'service_name' if if appears in sts_client_kwargs
47
50
  if "service_name" in sts_client_kwargs:
48
51
  BRSWarning(
49
- "'sts_client_kwargs' cannot contain values for 'service_name'. Reverting to service_name = 'sts'."
52
+ "'sts_client_kwargs' cannot contain values for "
53
+ "'service_name'. Reverting to service_name = 'sts'."
50
54
  )
51
55
  del sts_client_kwargs["service_name"]
52
56
  self._sts_client = self.client(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3-refresh-session
3
- Version: 1.3.14
3
+ Version: 1.3.16
4
4
  Summary: A simple Python package for refreshing the temporary security credentials in a boto3.session.Session object automatically.
5
5
  License: MIT
6
6
  Keywords: boto3,botocore,aws,sts,ecs,credentials,token,refresh
@@ -0,0 +1,11 @@
1
+ boto3_refresh_session/__init__.py,sha256=zb1pSAs5tu6DDGFJibXDoMxTB0wxFynt2USx0PWKziw,364
2
+ boto3_refresh_session/custom.py,sha256=xW_OiAO1D6-uPj-JWMjXmgNy1BpQxvF7nWavrGZtrqA,3795
3
+ boto3_refresh_session/ecs.py,sha256=2lLMDWEE_JArBf0sRtcFmrzxiIpo_S6dauHS-TDUn4U,3713
4
+ boto3_refresh_session/exceptions.py,sha256=qcFzdIuK5PZirs77H_Kb64S9QFb6cn2OJtirjvaRLiY,972
5
+ boto3_refresh_session/session.py,sha256=wtaLKf2DOnUpt9wJLP_9j2zJEhhFRcUMBNvKBzWY7-Q,5351
6
+ boto3_refresh_session/sts.py,sha256=gJKbslmNl8kR8oAeZfOGmrHtgUUxMm7e9hPgZO678FE,3174
7
+ boto3_refresh_session-1.3.16.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
8
+ boto3_refresh_session-1.3.16.dist-info/METADATA,sha256=yoKsAPM28pzClq58vh67pLCVhx_D_ewUHwcj9I9w9WE,7804
9
+ boto3_refresh_session-1.3.16.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
10
+ boto3_refresh_session-1.3.16.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ boto3_refresh_session-1.3.16.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- boto3_refresh_session/__init__.py,sha256=qSjarWJetA_IkabLoWIJbYTOuiNVwPON7tdngne5Pk0,364
2
- boto3_refresh_session/custom.py,sha256=L3kQ_6e-lmIGgm1GHLngOqJOzeS-oDFoVCPTkva0-PA,3760
3
- boto3_refresh_session/ecs.py,sha256=WIC5mlbcEnM1oo-QXmmtiw2mjFDn01hBfcFh67ku42A,3713
4
- boto3_refresh_session/exceptions.py,sha256=qcFzdIuK5PZirs77H_Kb64S9QFb6cn2OJtirjvaRLiY,972
5
- boto3_refresh_session/session.py,sha256=u1gSsYH3OpcbIurMS2nstPbQtOO-S9GZsuk_yhjEqAI,5304
6
- boto3_refresh_session/sts.py,sha256=paIgbmn9a3cATNX-6AEGxnSGNZnX1pj4rRQmh8gQSKs,3132
7
- boto3_refresh_session-1.3.14.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
8
- boto3_refresh_session-1.3.14.dist-info/METADATA,sha256=4vO31xWnFxIFhpQ4UPGMM1P_ymRPmtsHYaUJs9EoWzM,7804
9
- boto3_refresh_session-1.3.14.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
10
- boto3_refresh_session-1.3.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
- boto3_refresh_session-1.3.14.dist-info/RECORD,,