boto3-refresh-session 2.0.8__py3-none-any.whl → 2.0.9__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.
@@ -4,7 +4,7 @@ from .methods.sts import STSRefreshableSession
4
4
  from .session import RefreshableSession
5
5
 
6
6
  __all__ = ["RefreshableSession"]
7
- __version__ = "2.0.8"
7
+ __version__ = "2.0.9"
8
8
  __title__ = "boto3-refresh-session"
9
9
  __author__ = "Mike Letts"
10
10
  __maintainer__ = "Mike Letts"
@@ -6,7 +6,12 @@ from typing import Any, Callable
6
6
 
7
7
  from ..exceptions import BRSError, BRSWarning
8
8
  from ..session import BaseRefreshableSession
9
- from ..utils import TemporaryCredentials, refreshable_session
9
+ from ..utils import (
10
+ CustomCredentialsMethod,
11
+ CustomCredentialsMethodArgs,
12
+ TemporaryCredentials,
13
+ refreshable_session,
14
+ )
10
15
 
11
16
 
12
17
  @refreshable_session
@@ -18,11 +23,11 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
18
23
 
19
24
  Parameters
20
25
  ----------
21
- custom_credentials_method: Callable
26
+ custom_credentials_method: CustomCredentialsMethod
22
27
  Required. Accepts a callable object that returns temporary AWS
23
28
  security credentials. That object must return a dictionary containing
24
29
  'access_key', 'secret_key', 'token', and 'expiry_time' when called.
25
- custom_credentials_method_args : dict[str, Any], optional
30
+ custom_credentials_method_args : CustomCredentialsMethodArgs, optional
26
31
  Optional keyword arguments for the function passed to the
27
32
  ``custom_credentials_method`` parameter.
28
33
  defer_refresh : bool, optional
@@ -62,8 +67,10 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
62
67
 
63
68
  def __init__(
64
69
  self,
65
- custom_credentials_method: Callable,
66
- custom_credentials_method_args: dict[str, Any] | None = None,
70
+ custom_credentials_method: CustomCredentialsMethod,
71
+ custom_credentials_method_args: (
72
+ CustomCredentialsMethodArgs | None
73
+ ) = None,
67
74
  **kwargs,
68
75
  ):
69
76
  if "refresh_method" in kwargs:
@@ -75,8 +82,10 @@ class CustomRefreshableSession(BaseRefreshableSession, registry_key="custom"):
75
82
 
76
83
  # initializing BRSSession
77
84
  super().__init__(refresh_method="custom", **kwargs)
78
- self._custom_get_credentials = custom_credentials_method
79
- self._custom_get_credentials_args = (
85
+ self._custom_get_credentials: CustomCredentialsMethod = (
86
+ custom_credentials_method
87
+ )
88
+ self._custom_get_credentials_args: CustomCredentialsMethodArgs = (
80
89
  custom_credentials_method_args
81
90
  if custom_credentials_method_args is not None
82
91
  else {}
@@ -10,6 +10,9 @@ from typing import (
10
10
  Generic,
11
11
  List,
12
12
  Literal,
13
+ Mapping,
14
+ Protocol,
15
+ TypeAlias,
13
16
  TypedDict,
14
17
  TypeVar,
15
18
  cast,
@@ -126,6 +129,17 @@ class TemporaryCredentials(TypedDict):
126
129
  expiry_time: datetime | str
127
130
 
128
131
 
132
+ class _CustomCredentialsMethod(Protocol):
133
+ def __call__(self, **kwargs: Any) -> TemporaryCredentials: ...
134
+
135
+
136
+ #: Type alias for custom credential retrieval methods.
137
+ CustomCredentialsMethod: TypeAlias = _CustomCredentialsMethod
138
+
139
+ #: Type alias for custom credential method arguments.
140
+ CustomCredentialsMethodArgs: TypeAlias = Mapping[str, Any]
141
+
142
+
129
143
  class RefreshableTemporaryCredentials(TypedDict):
130
144
  """Refreshable IAM credentials.
131
145
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3-refresh-session
3
- Version: 2.0.8
3
+ Version: 2.0.9
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
@@ -1,7 +1,7 @@
1
- boto3_refresh_session/__init__.py,sha256=HfXKz-omIFHEIEjjPVuwpmkqrAox_HU_IFXeTrVTazU,387
1
+ boto3_refresh_session/__init__.py,sha256=oUmq6AKEMx1Gvi0U6BPMiktIargvfJVoMwyC4jm60eA,387
2
2
  boto3_refresh_session/exceptions.py,sha256=cP5d9S8QnUEwXIU3pzMGr6jMOz447kddNJ_UIRERMrk,964
3
3
  boto3_refresh_session/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- boto3_refresh_session/methods/custom.py,sha256=-KzDFOykdbjXMwGYVJZP8Qbwz8zEbS0R8BtJE8vvfWw,3976
4
+ boto3_refresh_session/methods/custom.py,sha256=fMqaSgbmv-mfDMe1lXEPF1V4dQcwPsCN8qcRHW2IeqE,4209
5
5
  boto3_refresh_session/methods/ecs.py,sha256=aXQXS7beS2RBXIeQkUNQkM4zhtDQv0n1Mkf9wnFbOTE,3931
6
6
  boto3_refresh_session/methods/iot/__init__.typed,sha256=Z33nIB6oCsz9TZwikHfNHgY1SKxkSCdB5rwdPSUl3C4,135
7
7
  boto3_refresh_session/methods/iot/certificate.typed,sha256=xBucJJfRb0_iKuhbtRxOWeRERzyJxo7iYW6-0VbmdA0,1816
@@ -9,9 +9,9 @@ boto3_refresh_session/methods/iot/cognito.typed,sha256=OgFYOCDIkt2QC_F0KLL_BrxVx
9
9
  boto3_refresh_session/methods/iot/core.typed,sha256=tL-ngB2XYq0XtxhS9mbggCJYdX3eEE0u1Gvcq8sEYGE,1422
10
10
  boto3_refresh_session/methods/sts.py,sha256=FvblbuXDaczEfsRIs59eKOodrJjHcMKHrnrmxjXfNeU,3401
11
11
  boto3_refresh_session/session.py,sha256=_Z3uB5Xq3S-dFqOFmWhMQbcd__NPGThjULLPStHI6E4,2914
12
- boto3_refresh_session/utils.py,sha256=SBzqLeCsAWpDJfGNjIvYPZ5cEKClluOzATHgLKxSWMA,7590
13
- boto3_refresh_session-2.0.8.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
14
- boto3_refresh_session-2.0.8.dist-info/METADATA,sha256=MQZkpUhHdFISwB07q_tKXNV6iGlRaWJ-TaX0x4MSrBw,8795
15
- boto3_refresh_session-2.0.8.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
16
- boto3_refresh_session-2.0.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- boto3_refresh_session-2.0.8.dist-info/RECORD,,
12
+ boto3_refresh_session/utils.py,sha256=9Nru9GWWMAboDRJMstKIBFtKA2R8u3DFFcCvsQYSNCI,7976
13
+ boto3_refresh_session-2.0.9.dist-info/LICENSE,sha256=I3ZYTXAjbIly6bm6J-TvFTuuHwTKws4h89QaY5c5HiY,1067
14
+ boto3_refresh_session-2.0.9.dist-info/METADATA,sha256=0M9RJlmPWHbmYrbgz1MjLU7BaSsm8wpr4dAkuJJ86Hs,8795
15
+ boto3_refresh_session-2.0.9.dist-info/NOTICE,sha256=1s8r33qbl1z0YvPB942iWgvbkP94P_e8AnROr1qXXuw,939
16
+ boto3_refresh_session-2.0.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ boto3_refresh_session-2.0.9.dist-info/RECORD,,