boto3-refresh-session 3.0.1__tar.gz → 3.0.3__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 (19) hide show
  1. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/PKG-INFO +71 -5
  2. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/README.md +70 -4
  3. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/__init__.py +1 -1
  4. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/pyproject.toml +1 -1
  5. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/LICENSE +0 -0
  6. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/NOTICE +0 -0
  7. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/exceptions.py +0 -0
  8. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/__init__.py +0 -0
  9. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/custom.py +0 -0
  10. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/ecs.py +0 -0
  11. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/iot/__init__.typed +0 -0
  12. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/iot/certificate.typed +0 -0
  13. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/iot/cognito.typed +0 -0
  14. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/iot/core.typed +0 -0
  15. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/methods/sts.py +0 -0
  16. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/session.py +0 -0
  17. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/utils/__init__.py +0 -0
  18. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/boto3_refresh_session/utils/internal.py +0 -0
  19. {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.3}/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: 3.0.1
3
+ Version: 3.0.3
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
@@ -162,12 +162,78 @@ pip install boto3-refresh-session
162
162
 
163
163
  ## 📝 Usage
164
164
 
165
+ <details>
166
+ <summary><strong>Clients and Resources (click to expand)</strong></summary>
167
+
168
+ ### Clients and Resources
169
+
170
+ Most developers who use `boto3` interact primarily with `boto3.client` or `boto3.resource` instead of `boto3.session.Session`. But many developers may not realize that `boto3.session.Session` belies `boto3.client` and `boto3.resource`! In fact, that's precisely what makes `boto3-refresh-session` possible!
171
+
172
+ To use the `boto3.client` or `boto3.resource` interface, but with the benefits of `boto3-refresh-session`, you have a few options!
173
+
174
+ In the following examples, let's assume you want to use STS for retrieving temporary credentials for the sake of simplicity. Let's also focus specifically on `client`. Switching to `resource` follows the same exact idioms as below, except that `client` must be switched to `resource` in the pseudo-code, obviously. If you are not sure how to use `RefreshableSession` for STS (or ECS or custom auth flows) then check the usage instructions in the following sections!
175
+
176
+ ##### `RefreshableSession.client` (Recommended)
177
+
178
+ So long as you reuse the same `session` object when creating `client` and `resource` objects, this approach can be used everywhere in your code. It is very simple and straight-forward!
179
+
180
+ ```python
181
+ from boto3_refresh_session import RefreshableSession
182
+
183
+ assume_role_kwargs = {
184
+ "RoleArn": "<your-role-arn>",
185
+ "RoleSessionName": "<your-role-session-name>",
186
+ "DurationSeconds": "<your-selection>",
187
+ ...
188
+ }
189
+ session = RefreshableSession(assume_role_kwargs=assume_role_kwargs)
190
+ s3 = session.client("s3")
191
+ ```
192
+
193
+ ##### `DEFAULT_SESSION`
194
+
195
+ This technique can be helpful if you want to use the same instance of `RefreshableSession` everywhere in your code without reference to `boto3_refresh_session`!
196
+
197
+ ```python
198
+ from boto3 import DEFAULT_SESSION, client
199
+ from boto3_refresh_session import RefreshableSession
200
+
201
+ assume_role_kwargs = {
202
+ "RoleArn": "<your-role-arn>",
203
+ "RoleSessionName": "<your-role-session-name>",
204
+ "DurationSeconds": "<your-selection>",
205
+ ...
206
+ }
207
+ DEFAULT_SESSION = RefreshableSession(assume_role_kwargs=assume_role_kwargs)
208
+ s3 = client("s3")
209
+ ```
210
+
211
+ ##### `botocore_session`
212
+
213
+ ```python
214
+ from boto3 import client
215
+ from boto3_refresh_session import RefreshableSession
216
+
217
+ assume_role_kwargs = {
218
+ "RoleArn": "<your-role-arn>",
219
+ "RoleSessionName": "<your-role-session-name>",
220
+ "DurationSeconds": "<your-selection>",
221
+ ...
222
+ }
223
+ s3 = client(
224
+ service_name="s3",
225
+ botocore_session=RefreshableSession(assume_role_kwargs=assume_role_kwargs)
226
+ )
227
+ ```
228
+
229
+ </details>
230
+
165
231
  <details>
166
232
  <summary><strong>STS (click to expand)</strong></summary>
167
233
 
168
234
  ### STS
169
235
 
170
- Most users use AWS STS to assume an IAM role and return a set of temporary security credentials. boto3-refresh-session can be used to ensure those temporary credentials refresh automatically.
236
+ Most developers use AWS STS to assume an IAM role and return a set of temporary security credentials. boto3-refresh-session can be used to ensure those temporary credentials refresh automatically. For additional information on the exact parameters that `RefreshableSession` takes for STS, [check this documentation](https://github.com/michaelthomasletts/boto3-refresh-session/blob/main/boto3_refresh_session/methods/sts.py).
171
237
 
172
238
  ```python
173
239
  import boto3_refresh_session as brs
@@ -208,7 +274,7 @@ pip install boto3-refresh-session
208
274
 
209
275
  ### ECS
210
276
 
211
- You can use boto3-refresh-session in an ECS container to automatically refresh temporary security credentials.
277
+ You can use boto3-refresh-session in an ECS container to automatically refresh temporary security credentials. For additional information on the exact parameters that `RefreshableSession` takes for ECS, [check this documentation](https://github.com/michaelthomasletts/boto3-refresh-session/blob/main/boto3_refresh_session/methods/ecs.py).
212
278
 
213
279
  ```python
214
280
  session = RefreshableSession(
@@ -222,11 +288,11 @@ pip install boto3-refresh-session
222
288
  </details>
223
289
 
224
290
  <details>
225
- <summary><strong>Custom authentication flows (click to expand)</strong></summary>
291
+ <summary><strong>Custom Authentication Flows (click to expand)</strong></summary>
226
292
 
227
293
  ### Custom
228
294
 
229
- If you have a highly sophisticated, novel, or idiosyncratic authentication flow not included in boto3-refresh-session then you will need to provide your own custom temporary credentials callable object. `RefreshableSession` accepts custom credentials callable objects, as shown below.
295
+ If you have a highly sophisticated, novel, or idiosyncratic authentication flow not included in boto3-refresh-session then you will need to provide your own custom temporary credentials callable object. `RefreshableSession` accepts custom credentials callable objects, as shown below. For additional information on the exact parameters that `RefreshableSession` takes for custom authentication flows, [check this documentation](https://github.com/michaelthomasletts/boto3-refresh-session/blob/main/boto3_refresh_session/methods/custom.py).
230
296
 
231
297
  ```python
232
298
  # create (or import) your custom credential method
@@ -137,12 +137,78 @@ pip install boto3-refresh-session
137
137
 
138
138
  ## 📝 Usage
139
139
 
140
+ <details>
141
+ <summary><strong>Clients and Resources (click to expand)</strong></summary>
142
+
143
+ ### Clients and Resources
144
+
145
+ Most developers who use `boto3` interact primarily with `boto3.client` or `boto3.resource` instead of `boto3.session.Session`. But many developers may not realize that `boto3.session.Session` belies `boto3.client` and `boto3.resource`! In fact, that's precisely what makes `boto3-refresh-session` possible!
146
+
147
+ To use the `boto3.client` or `boto3.resource` interface, but with the benefits of `boto3-refresh-session`, you have a few options!
148
+
149
+ In the following examples, let's assume you want to use STS for retrieving temporary credentials for the sake of simplicity. Let's also focus specifically on `client`. Switching to `resource` follows the same exact idioms as below, except that `client` must be switched to `resource` in the pseudo-code, obviously. If you are not sure how to use `RefreshableSession` for STS (or ECS or custom auth flows) then check the usage instructions in the following sections!
150
+
151
+ ##### `RefreshableSession.client` (Recommended)
152
+
153
+ So long as you reuse the same `session` object when creating `client` and `resource` objects, this approach can be used everywhere in your code. It is very simple and straight-forward!
154
+
155
+ ```python
156
+ from boto3_refresh_session import RefreshableSession
157
+
158
+ assume_role_kwargs = {
159
+ "RoleArn": "<your-role-arn>",
160
+ "RoleSessionName": "<your-role-session-name>",
161
+ "DurationSeconds": "<your-selection>",
162
+ ...
163
+ }
164
+ session = RefreshableSession(assume_role_kwargs=assume_role_kwargs)
165
+ s3 = session.client("s3")
166
+ ```
167
+
168
+ ##### `DEFAULT_SESSION`
169
+
170
+ This technique can be helpful if you want to use the same instance of `RefreshableSession` everywhere in your code without reference to `boto3_refresh_session`!
171
+
172
+ ```python
173
+ from boto3 import DEFAULT_SESSION, client
174
+ from boto3_refresh_session import RefreshableSession
175
+
176
+ assume_role_kwargs = {
177
+ "RoleArn": "<your-role-arn>",
178
+ "RoleSessionName": "<your-role-session-name>",
179
+ "DurationSeconds": "<your-selection>",
180
+ ...
181
+ }
182
+ DEFAULT_SESSION = RefreshableSession(assume_role_kwargs=assume_role_kwargs)
183
+ s3 = client("s3")
184
+ ```
185
+
186
+ ##### `botocore_session`
187
+
188
+ ```python
189
+ from boto3 import client
190
+ from boto3_refresh_session import RefreshableSession
191
+
192
+ assume_role_kwargs = {
193
+ "RoleArn": "<your-role-arn>",
194
+ "RoleSessionName": "<your-role-session-name>",
195
+ "DurationSeconds": "<your-selection>",
196
+ ...
197
+ }
198
+ s3 = client(
199
+ service_name="s3",
200
+ botocore_session=RefreshableSession(assume_role_kwargs=assume_role_kwargs)
201
+ )
202
+ ```
203
+
204
+ </details>
205
+
140
206
  <details>
141
207
  <summary><strong>STS (click to expand)</strong></summary>
142
208
 
143
209
  ### STS
144
210
 
145
- Most users use AWS STS to assume an IAM role and return a set of temporary security credentials. boto3-refresh-session can be used to ensure those temporary credentials refresh automatically.
211
+ Most developers use AWS STS to assume an IAM role and return a set of temporary security credentials. boto3-refresh-session can be used to ensure those temporary credentials refresh automatically. For additional information on the exact parameters that `RefreshableSession` takes for STS, [check this documentation](https://github.com/michaelthomasletts/boto3-refresh-session/blob/main/boto3_refresh_session/methods/sts.py).
146
212
 
147
213
  ```python
148
214
  import boto3_refresh_session as brs
@@ -183,7 +249,7 @@ pip install boto3-refresh-session
183
249
 
184
250
  ### ECS
185
251
 
186
- You can use boto3-refresh-session in an ECS container to automatically refresh temporary security credentials.
252
+ You can use boto3-refresh-session in an ECS container to automatically refresh temporary security credentials. For additional information on the exact parameters that `RefreshableSession` takes for ECS, [check this documentation](https://github.com/michaelthomasletts/boto3-refresh-session/blob/main/boto3_refresh_session/methods/ecs.py).
187
253
 
188
254
  ```python
189
255
  session = RefreshableSession(
@@ -197,11 +263,11 @@ pip install boto3-refresh-session
197
263
  </details>
198
264
 
199
265
  <details>
200
- <summary><strong>Custom authentication flows (click to expand)</strong></summary>
266
+ <summary><strong>Custom Authentication Flows (click to expand)</strong></summary>
201
267
 
202
268
  ### Custom
203
269
 
204
- If you have a highly sophisticated, novel, or idiosyncratic authentication flow not included in boto3-refresh-session then you will need to provide your own custom temporary credentials callable object. `RefreshableSession` accepts custom credentials callable objects, as shown below.
270
+ If you have a highly sophisticated, novel, or idiosyncratic authentication flow not included in boto3-refresh-session then you will need to provide your own custom temporary credentials callable object. `RefreshableSession` accepts custom credentials callable objects, as shown below. For additional information on the exact parameters that `RefreshableSession` takes for custom authentication flows, [check this documentation](https://github.com/michaelthomasletts/boto3-refresh-session/blob/main/boto3_refresh_session/methods/custom.py).
205
271
 
206
272
  ```python
207
273
  # create (or import) your custom credential method
@@ -9,7 +9,7 @@ from .session import *
9
9
 
10
10
  __all__.extend(session.__all__)
11
11
  __all__.extend(exceptions.__all__)
12
- __version__ = "3.0.1"
12
+ __version__ = "3.0.3"
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 = "3.0.1"
3
+ version = "3.0.3"
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"}