Skip to content

Commit 3dd8ce2

Browse files
Typing fix: use float instead of int for lifespan and timeout (#1068)
* Allow 'float' for timedelta seconds * fix: add change to CHANGELOG.rst
1 parent 8a1d63b commit 3dd8ce2

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Fixed
1313
- Add iterator for JWKSet in `#1041 <https://github.com/jpadilla/pyjwt/pull/1041>`__
1414
- Validate `iss` claim is a string during encoding and decoding by @pachewise in `#1040 <https://github.com/jpadilla/pyjwt/pull/1040>`__
1515
- Improve typing/logic for `options` in decode, decode_complete by @pachewise in `#1045 <https://github.com/jpadilla/pyjwt/pull/1045>`__
16+
- Declare float supported type for lifespan and timeout by @nikitagashkov in `#1068 <https://github.com/jpadilla/pyjwt/pull/1068>`__
1617

1718
Added
1819
~~~~~

jwt/jwk_set_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class JWKSetCache:
8-
def __init__(self, lifespan: int) -> None:
8+
def __init__(self, lifespan: float) -> None:
99
self.jwk_set_with_timestamp: Optional[PyJWTSetWithTimestamp] = None
1010
self.lifespan = lifespan
1111

jwt/jwks_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def __init__(
2020
cache_keys: bool = False,
2121
max_cached_keys: int = 16,
2222
cache_jwk_set: bool = True,
23-
lifespan: int = 300,
23+
lifespan: float = 300,
2424
headers: Optional[Dict[str, Any]] = None,
25-
timeout: int = 30,
25+
timeout: float = 30,
2626
ssl_context: Optional[SSLContext] = None,
2727
):
2828
if headers is None:

0 commit comments

Comments
 (0)