boto3-refresh-session 5.1.4__tar.gz → 5.1.6__tar.gz

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.
Files changed (17) hide show
  1. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/PKG-INFO +33 -14
  2. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/README.md +32 -13
  3. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/__init__.py +1 -1
  4. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/pyproject.toml +1 -1
  5. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/LICENSE +0 -0
  6. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/NOTICE +0 -0
  7. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/exceptions.py +0 -0
  8. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/methods/__init__.py +0 -0
  9. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/methods/custom.py +0 -0
  10. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/methods/iot/__init__.py +0 -0
  11. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/methods/iot/core.py +0 -0
  12. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/methods/iot/x509.py +0 -0
  13. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/methods/sts.py +0 -0
  14. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/session.py +0 -0
  15. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/utils/__init__.py +0 -0
  16. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/utils/internal.py +0 -0
  17. {boto3_refresh_session-5.1.4 → boto3_refresh_session-5.1.6}/boto3_refresh_session/utils/typing.py +0 -0
@@ -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
 
@@ -125,6 +125,25 @@ pip install boto3-refresh-session
125
125
 
126
126
  ## 📝 Usage
127
127
 
128
+ <details>
129
+ <summary><strong>Core Concepts (click to expand)</strong></summary>
130
+
131
+ ### Core Concepts
132
+
133
+ 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`.
134
+
135
+ 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.
136
+
137
+ 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.
138
+
139
+ 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).
140
+
141
+ 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.
142
+
143
+ 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.
144
+
145
+ </details>
146
+
128
147
  <details>
129
148
  <summary><strong>Clients and Resources (click to expand)</strong></summary>
130
149
 
@@ -201,12 +220,12 @@ pip install boto3-refresh-session
201
220
  ```python
202
221
  import boto3_refresh_session as brs
203
222
 
204
- # you can pass all of the params normally associated with boto3.session.Session
223
+ # OPTIONAL - you can pass all of the params normally associated with boto3.session.Session
205
224
  profile_name = "<your-profile-name>"
206
225
  region_name = "us-east-1"
207
226
  ...
208
227
 
209
- # as well as all of the params associated with STS.Client.assume_role
228
+ # REQUIRED - as well as all of the params associated with STS.Client.assume_role
210
229
  assume_role_kwargs = {
211
230
  "RoleArn": "<your-role-arn>",
212
231
  "RoleSessionName": "<your-role-session-name>",
@@ -214,7 +233,7 @@ pip install boto3-refresh-session
214
233
  ...
215
234
  }
216
235
 
217
- # as well as all of the params associated with STS.Client, except for 'service_name'
236
+ # OPTIONAL - as well as all of the params associated with STS.Client, except for 'service_name'
218
237
  sts_client_kwargs = {
219
238
  "region_name": region_name,
220
239
  ...
@@ -223,10 +242,10 @@ pip install boto3-refresh-session
223
242
  # basic initialization of boto3.session.Session
224
243
  session = brs.RefreshableSession(
225
244
  assume_role_kwargs=assume_role_kwargs, # required
226
- sts_client_kwargs=sts_client_kwargs,
227
- region_name=region_name,
228
- profile_name=profile_name,
229
- ...
245
+ sts_client_kwargs=sts_client_kwargs, # optional
246
+ region_name=region_name, # optional
247
+ profile_name=profile_name, # optional
248
+ ... # misc. params for boto3.session.Session
230
249
  )
231
250
  ```
232
251
 
@@ -252,12 +271,12 @@ pip install boto3-refresh-session
252
271
 
253
272
  # and pass it to RefreshableSession
254
273
  session = RefreshableSession(
255
- method="custom",
256
- custom_credentials_method=your_custom_credential_getter,
257
- custom_credentials_method_args=...,
258
- region_name=region_name,
259
- profile_name=profile_name,
260
- ...
274
+ method="custom", # required
275
+ custom_credentials_method=your_custom_credential_getter, # required
276
+ custom_credentials_method_args=..., # optional
277
+ region_name=region_name, # optional
278
+ profile_name=profile_name, # optional
279
+ ... # misc. params for boto3.session.Session
261
280
  )
262
281
  ```
263
282
 
@@ -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
  [project]
2
2
  name = "boto3-refresh-session"
3
- version = "5.1.4"
3
+ version = "5.1.6"
4
4
  description = "A simple Python package for refreshing the temporary security credentials in a boto3.session.Session object automatically."
5
5
  authors = [
6
6
  {name = "Mike Letts",email = "lettsmt@gmail.com"}