boto3-refresh-session 1.3.6__py3-none-any.whl → 1.3.7__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.
- boto3_refresh_session/__init__.py +1 -1
- boto3_refresh_session/custom.py +19 -7
- {boto3_refresh_session-1.3.6.dist-info → boto3_refresh_session-1.3.7.dist-info}/METADATA +2 -2
- boto3_refresh_session-1.3.7.dist-info/RECORD +11 -0
- boto3_refresh_session-1.3.6.dist-info/RECORD +0 -11
- {boto3_refresh_session-1.3.6.dist-info → boto3_refresh_session-1.3.7.dist-info}/LICENSE +0 -0
- {boto3_refresh_session-1.3.6.dist-info → boto3_refresh_session-1.3.7.dist-info}/NOTICE +0 -0
- {boto3_refresh_session-1.3.6.dist-info → boto3_refresh_session-1.3.7.dist-info}/WHEEL +0 -0
boto3_refresh_session/custom.py
CHANGED
@@ -4,6 +4,7 @@ __all__ = ["CustomRefreshableSession"]
|
|
4
4
|
|
5
5
|
from typing import Any, Callable
|
6
6
|
|
7
|
+
from .exceptions import BRSError
|
7
8
|
from .session import BaseRefreshableSession
|
8
9
|
|
9
10
|
|
@@ -50,7 +51,7 @@ class CustomRefreshableSession(BaseRefreshableSession, method="custom"):
|
|
50
51
|
>>> sess = RefreshableSession(
|
51
52
|
>>> method='custom',
|
52
53
|
>>> custom_credentials_method=your_custom_credential_getter,
|
53
|
-
>>>
|
54
|
+
>>> custom_credentials_method_args=...,
|
54
55
|
>>> )
|
55
56
|
"""
|
56
57
|
|
@@ -77,11 +78,20 @@ class CustomRefreshableSession(BaseRefreshableSession, method="custom"):
|
|
77
78
|
)
|
78
79
|
|
79
80
|
def _get_credentials(self) -> dict[str, str]:
|
80
|
-
|
81
|
+
credentials = self._custom_get_credentials(
|
81
82
|
**self._custom_get_credentials_args
|
82
83
|
)
|
84
|
+
required_keys = {"access_key", "secret_key", "token", "expiry_time"}
|
83
85
|
|
84
|
-
|
86
|
+
if missing := required_keys - credentials.keys():
|
87
|
+
raise BRSError(
|
88
|
+
f"The dict returned by custom_credentials_method is missing these key-value pairs: "
|
89
|
+
f"{', '.join(repr(param) for param in missing)}. "
|
90
|
+
)
|
91
|
+
|
92
|
+
return credentials
|
93
|
+
|
94
|
+
def get_identity(self) -> dict[str, str]:
|
85
95
|
"""Returns metadata about the custom credential getter.
|
86
96
|
|
87
97
|
Returns
|
@@ -90,7 +100,9 @@ class CustomRefreshableSession(BaseRefreshableSession, method="custom"):
|
|
90
100
|
Dict containing information about the custom credential getter.
|
91
101
|
"""
|
92
102
|
|
93
|
-
|
94
|
-
|
95
|
-
"
|
96
|
-
|
103
|
+
source = getattr(
|
104
|
+
self._custom_get_credentials,
|
105
|
+
"__name__",
|
106
|
+
repr(self._custom_get_credentials),
|
107
|
+
)
|
108
|
+
return {"method": "custom", "source": repr(source)}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: boto3-refresh-session
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.7
|
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
|
@@ -170,7 +170,7 @@ def your_custom_credential_getter(...):
|
|
170
170
|
session = RefreshableSession(
|
171
171
|
method="custom",
|
172
172
|
custom_credentials_method=your_custom_credential_getter,
|
173
|
-
|
173
|
+
custom_credentials_method_args=...,
|
174
174
|
region_name=region_name,
|
175
175
|
profile_name=profile_name,
|
176
176
|
...
|
@@ -0,0 +1,11 @@
|
|
1
|
+
boto3_refresh_session/__init__.py,sha256=Uv136RK6A7H9vQ1nzXPCuIrJBbKZmH8DQaznDFduILU,200
|
2
|
+
boto3_refresh_session/custom.py,sha256=0EemEoai-CnixXpFyvjmE5M9QffgBRZpMoTIwQPaxmY,3744
|
3
|
+
boto3_refresh_session/ecs.py,sha256=WIC5mlbcEnM1oo-QXmmtiw2mjFDn01hBfcFh67ku42A,3713
|
4
|
+
boto3_refresh_session/exceptions.py,sha256=qcFzdIuK5PZirs77H_Kb64S9QFb6cn2OJtirjvaRLiY,972
|
5
|
+
boto3_refresh_session/session.py,sha256=ak8lvgoHMObaJgL4c80ih4bptRHS3ASojnaWdbxn5kA,5246
|
6
|
+
boto3_refresh_session/sts.py,sha256=paIgbmn9a3cATNX-6AEGxnSGNZnX1pj4rRQmh8gQSKs,3132
|
7
|
+
boto3_refresh_session-1.3.7.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
8
|
+
boto3_refresh_session-1.3.7.dist-info/METADATA,sha256=ORil-xBwlFnv7oaFgiVN8XKglY9HM0A9jF_2j7LDmxY,7033
|
9
|
+
boto3_refresh_session-1.3.7.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
|
10
|
+
boto3_refresh_session-1.3.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
+
boto3_refresh_session-1.3.7.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
boto3_refresh_session/__init__.py,sha256=944rMVW-eSGvXJhL0-LFD1qSsN1e604qkP6dst8D_-4,200
|
2
|
-
boto3_refresh_session/custom.py,sha256=ZnN94A69Eku9L-kHZ7JJxn_aWbrt6mJDWOIEWrJrIcY,3229
|
3
|
-
boto3_refresh_session/ecs.py,sha256=WIC5mlbcEnM1oo-QXmmtiw2mjFDn01hBfcFh67ku42A,3713
|
4
|
-
boto3_refresh_session/exceptions.py,sha256=qcFzdIuK5PZirs77H_Kb64S9QFb6cn2OJtirjvaRLiY,972
|
5
|
-
boto3_refresh_session/session.py,sha256=ak8lvgoHMObaJgL4c80ih4bptRHS3ASojnaWdbxn5kA,5246
|
6
|
-
boto3_refresh_session/sts.py,sha256=paIgbmn9a3cATNX-6AEGxnSGNZnX1pj4rRQmh8gQSKs,3132
|
7
|
-
boto3_refresh_session-1.3.6.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
|
8
|
-
boto3_refresh_session-1.3.6.dist-info/METADATA,sha256=noSVW3kcFe92PA5JXoM1qwIt3xgrtVePNNIJiPwDjX4,7034
|
9
|
-
boto3_refresh_session-1.3.6.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
|
10
|
-
boto3_refresh_session-1.3.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
-
boto3_refresh_session-1.3.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|