boto3-refresh-session 3.0.1__py3-none-any.whl → 3.0.2__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__ = "3.0.1"
12
+ __version__ = "3.0.2"
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: 3.0.1
3
+ Version: 3.0.2
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,6 +162,72 @@ 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
 
@@ -222,7 +288,7 @@ 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
 
@@ -1,4 +1,4 @@
1
- boto3_refresh_session/__init__.py,sha256=iaw8zTxeQcjE6dJwDv_LOsgf7oR2z590qmEL9XE8JdI,415
1
+ boto3_refresh_session/__init__.py,sha256=U_4KlnYIh6xejqjTcBm2pZ49IcgQDuUKD75f39zaNeI,415
2
2
  boto3_refresh_session/exceptions.py,sha256=DumBh6cDVU46eelSNt1CsG2uMSBekSbmhqWEaAWw130,1003
3
3
  boto3_refresh_session/methods/__init__.py,sha256=zpVBJIR4P-l4pjE9kMnLGffehPVawY1vLiX2CPcpV7w,352
4
4
  boto3_refresh_session/methods/custom.py,sha256=j90Iv1DKdGgP1JNwQfpEhaJDBrB2AtDe8kqI2Mktwlg,4173
@@ -12,8 +12,8 @@ boto3_refresh_session/session.py,sha256=8YAdanwnJUG622Cv9MNKg25uj9ZmMYzRL4xiqH1i
12
12
  boto3_refresh_session/utils/__init__.py,sha256=6F2ErbgBT2ZmZwFF3OzvQEd1Vh4XM3kaL6YGMTrcrkQ,156
13
13
  boto3_refresh_session/utils/internal.py,sha256=bpKTAF_xdBw1wJPHIG8aGRMiXkSkp7CI9et0U5o3qEI,6103
14
14
  boto3_refresh_session/utils/typing.py,sha256=I4VJS1vkRwIRdJF08dZF1YgUed_anviz3hq4hLvPnLw,3537
15
- boto3_refresh_session-3.0.1.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
16
- boto3_refresh_session-3.0.1.dist-info/METADATA,sha256=jDNjmE2_DuJb0s-0kCujRb8JdQT6Awsy8NR4I4s7XKk,9228
17
- boto3_refresh_session-3.0.1.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
18
- boto3_refresh_session-3.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
19
- boto3_refresh_session-3.0.1.dist-info/RECORD,,
15
+ boto3_refresh_session-3.0.2.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
16
+ boto3_refresh_session-3.0.2.dist-info/METADATA,sha256=ej-tqjXupuJMux1_gMsQa-utAh47q1PFuhwkuT6_8DQ,11846
17
+ boto3_refresh_session-3.0.2.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
18
+ boto3_refresh_session-3.0.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
19
+ boto3_refresh_session-3.0.2.dist-info/RECORD,,