boto3-refresh-session 5.1.4__py3-none-any.whl → 5.1.6__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.
@@ -9,7 +9,7 @@ from .session import *
9
9
 
10
10
  __all__.extend(session.__all__)
11
11
  __all__.extend(exceptions.__all__)
12
- __version__ = "5.1.4"
12
+ __version__ = "5.1.6"
13
13
  __title__ = "boto3-refresh-session"
14
14
  __author__ = "Mike Letts"
15
15
  __maintainer__ = "Mike Letts"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3-refresh-session
3
- Version: 5.1.4
3
+ Version: 5.1.6
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,credentials,token,refresh,iot,x509,mqtt
@@ -152,6 +152,25 @@ pip install boto3-refresh-session
152
152
 
153
153
  ## 📝 Usage
154
154
 
155
+ <details>
156
+ <summary><strong>Core Concepts (click to expand)</strong></summary>
157
+
158
+ ### Core Concepts
159
+
160
+ 1. `RefreshableSession` is the intended interface for using `boto3-refresh-session`. Whether you're using this package to refresh temporary credentials returned by STS, the IoT credential provider (which is really just STS, but I digress), or some custom authentication or credential provider, `RefreshableSession` is where you *ought to* be working when using `boto3-refresh-session`.
161
+
162
+ 2. *You can use all of the same keyword parameters normally associated with `boto3.session.Session`!* For instance, suppose you want to pass `region_name` to `RefreshableSession` as a parameter, whereby it's passed to `boto3.session.Session`. That's perfectly fine! Just pass it like you normally would when initializing `boto3.session.Session`. These keyword parameters are *completely optional*, though. If you're confused, the main idea to remember is this: if initializing `boto3.session.Session` *requires* a particular keyword parameter then pass it to `RefreshableSession`; if not, don't worry about it.
163
+
164
+ 3. To tell `RefreshableSession` which AWS service you're working with for authentication and credential retrieval purposes (STS vs. IoT vs. some custom credential provider), you'll need to pass a `method` parameter to `RefreshableSession`. Since the `service_name` namespace is already occupied by `boto3.sesssion.Session`, [`boto3-refresh-session` uses `method` instead of "service" so as to avoid confusion](https://github.com/michaelthomasletts/boto3-refresh-session/blob/04acb2adb34e505c4dc95711f6b2f97748a2a489/boto3_refresh_session/utils/typing.py#L40). If you're using `RefreshableSession` for STS, however, then `method` is set to `"sts"` by default. You don't need to pass the `method` keyword argument in that case.
165
+
166
+ 4. Using `RefreshableSession` for STS, IoT, or custom flows requires different keyword parameters that are unique to those particular methods. For instance, `STSRefreshableSession`, which is the engine for STS in `boto3-refresh-session`, requires `assume_role_kwargs` and optionally allows `sts_client_kwargs` whereas `CustomRefreshableSession` and `IoTX509RefreshableSession` do not. To familiarize yourself with the keyword parameters for each method, check the documentation for each of those engines [in the Refresh Strategies section here](https://michaelthomasletts.com/boto3-refresh-session/modules/index.html).
167
+
168
+ 5. Irrespective of whatever `method` you pass as a keyword parameter, `RefreshableSession` accepts a keyword parameter named `defer_refresh`. Basically, this boolean tells `boto3-refresh-session` either to refresh credentials *the moment they expire* or to *wait until credentials are explicitly needed*. If you are working in a low-latency environment then `defer_refresh = False` might be helpful. For most users, however, `defer_refresh = True` is most desirable. For that reason, `defer_refresh = True` is the default value. Most users, therefore, should not concern themselves too much with this feature.
169
+
170
+ 6. Some developers struggle to imagine where `boto3-refresh-session` might be helpful. To figure out if `boto3-refresh-session` is for your use case, or whether `credential_process` satisfies your needs, check out [this blog post](https://michaelthomasletts.com/blog/brs-rationale/). `boto3-refresh-session` is not for every developer or use-case; it is a niche tool.
171
+
172
+ </details>
173
+
155
174
  <details>
156
175
  <summary><strong>Clients and Resources (click to expand)</strong></summary>
157
176
 
@@ -228,12 +247,12 @@ pip install boto3-refresh-session
228
247
  ```python
229
248
  import boto3_refresh_session as brs
230
249
 
231
- # you can pass all of the params normally associated with boto3.session.Session
250
+ # OPTIONAL - you can pass all of the params normally associated with boto3.session.Session
232
251
  profile_name = "<your-profile-name>"
233
252
  region_name = "us-east-1"
234
253
  ...
235
254
 
236
- # as well as all of the params associated with STS.Client.assume_role
255
+ # REQUIRED - as well as all of the params associated with STS.Client.assume_role
237
256
  assume_role_kwargs = {
238
257
  "RoleArn": "<your-role-arn>",
239
258
  "RoleSessionName": "<your-role-session-name>",
@@ -241,7 +260,7 @@ pip install boto3-refresh-session
241
260
  ...
242
261
  }
243
262
 
244
- # as well as all of the params associated with STS.Client, except for 'service_name'
263
+ # OPTIONAL - as well as all of the params associated with STS.Client, except for 'service_name'
245
264
  sts_client_kwargs = {
246
265
  "region_name": region_name,
247
266
  ...
@@ -250,10 +269,10 @@ pip install boto3-refresh-session
250
269
  # basic initialization of boto3.session.Session
251
270
  session = brs.RefreshableSession(
252
271
  assume_role_kwargs=assume_role_kwargs, # required
253
- sts_client_kwargs=sts_client_kwargs,
254
- region_name=region_name,
255
- profile_name=profile_name,
256
- ...
272
+ sts_client_kwargs=sts_client_kwargs, # optional
273
+ region_name=region_name, # optional
274
+ profile_name=profile_name, # optional
275
+ ... # misc. params for boto3.session.Session
257
276
  )
258
277
  ```
259
278
 
@@ -279,12 +298,12 @@ pip install boto3-refresh-session
279
298
 
280
299
  # and pass it to RefreshableSession
281
300
  session = RefreshableSession(
282
- method="custom",
283
- custom_credentials_method=your_custom_credential_getter,
284
- custom_credentials_method_args=...,
285
- region_name=region_name,
286
- profile_name=profile_name,
287
- ...
301
+ method="custom", # required
302
+ custom_credentials_method=your_custom_credential_getter, # required
303
+ custom_credentials_method_args=..., # optional
304
+ region_name=region_name, # optional
305
+ profile_name=profile_name, # optional
306
+ ... # misc. params for boto3.session.Session
288
307
  )
289
308
  ```
290
309
 
@@ -1,4 +1,4 @@
1
- boto3_refresh_session/__init__.py,sha256=3_RcKKPpjrgA1FROjtE9ASDX3RamBQK-HJSPhpn9nF4,415
1
+ boto3_refresh_session/__init__.py,sha256=bKBhRhrlKK1Jzczmcv7SUPbTb9sIBS_7CaMOxZrVsW8,415
2
2
  boto3_refresh_session/exceptions.py,sha256=QS5_xy3hNrfkdT_wKPZWH8WqSbFYCKPcK8DomGYIvcU,1218
3
3
  boto3_refresh_session/methods/__init__.py,sha256=FpwWixSVpy_6pUe1u4fXmjO-_fDH--qTk_xrMnBCHxU,193
4
4
  boto3_refresh_session/methods/custom.py,sha256=MLdUMU9s6NQoJWBKQ5Fsxeyxb_Xrm9V59pVX22M8fyI,4178
@@ -10,8 +10,8 @@ boto3_refresh_session/session.py,sha256=UM_dWHSo0Wn8gLN99zg36SRVb-Yy_to1wk8UgZEu
10
10
  boto3_refresh_session/utils/__init__.py,sha256=6F2ErbgBT2ZmZwFF3OzvQEd1Vh4XM3kaL6YGMTrcrkQ,156
11
11
  boto3_refresh_session/utils/internal.py,sha256=HbuIzT0pC8QS4pgNj3M7POGaW-OEz2l3ESfYI1Qouuo,7072
12
12
  boto3_refresh_session/utils/typing.py,sha256=YbnVYPe-ZEr79THp78u74PzF6LOIxpf91yGsvBmhEBM,3532
13
- boto3_refresh_session-5.1.4.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
14
- boto3_refresh_session-5.1.4.dist-info/METADATA,sha256=qlpE3DJIwtrPn6vDWtYcSWnFEqQGPNfaP0tLf_EeTR4,15084
15
- boto3_refresh_session-5.1.4.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
16
- boto3_refresh_session-5.1.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- boto3_refresh_session-5.1.4.dist-info/RECORD,,
13
+ boto3_refresh_session-5.1.6.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
14
+ boto3_refresh_session-5.1.6.dist-info/METADATA,sha256=S8KRZo0B_4NThrR_71wGPIBNDBDDzTUd9kwNUvIfe3c,18979
15
+ boto3_refresh_session-5.1.6.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
16
+ boto3_refresh_session-5.1.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ boto3_refresh_session-5.1.6.dist-info/RECORD,,