boto3-refresh-session 3.0.1__tar.gz → 3.0.2__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.
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/PKG-INFO +68 -2
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/README.md +67 -1
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/__init__.py +1 -1
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/pyproject.toml +1 -1
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/LICENSE +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/NOTICE +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/exceptions.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/__init__.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/custom.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/ecs.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/iot/__init__.typed +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/iot/certificate.typed +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/iot/cognito.typed +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/iot/core.typed +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/sts.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/session.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/utils/__init__.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/utils/internal.py +0 -0
- {boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/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.
|
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
|
291
|
+
<summary><strong>Custom Authentication Flows (click to expand)</strong></summary>
|
226
292
|
|
227
293
|
### Custom
|
228
294
|
|
@@ -137,6 +137,72 @@ 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
|
|
@@ -197,7 +263,7 @@ pip install boto3-refresh-session
|
|
197
263
|
</details>
|
198
264
|
|
199
265
|
<details>
|
200
|
-
<summary><strong>Custom
|
266
|
+
<summary><strong>Custom Authentication Flows (click to expand)</strong></summary>
|
201
267
|
|
202
268
|
### Custom
|
203
269
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "boto3-refresh-session"
|
3
|
-
version = "3.0.
|
3
|
+
version = "3.0.2"
|
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"}
|
File without changes
|
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/exceptions.py
RENAMED
File without changes
|
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/custom.py
RENAMED
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/ecs.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/methods/sts.py
RENAMED
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/session.py
RENAMED
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/utils/__init__.py
RENAMED
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/utils/internal.py
RENAMED
File without changes
|
{boto3_refresh_session-3.0.1 → boto3_refresh_session-3.0.2}/boto3_refresh_session/utils/typing.py
RENAMED
File without changes
|