diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 179c4400..fbfa6c84 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ Fixed - Add iterator for JWKSet in `#1041 `__ - Validate `iss` claim is a string during encoding and decoding by @pachewise in `#1040 `__ - Improve typing/logic for `options` in decode, decode_complete by @pachewise in `#1045 `__ +- Declare float supported type for lifespan and timeout by @nikitagashkov in `#1068 `__ Added ~~~~~ diff --git a/jwt/jwk_set_cache.py b/jwt/jwk_set_cache.py index 24325630..f3f3ca57 100644 --- a/jwt/jwk_set_cache.py +++ b/jwt/jwk_set_cache.py @@ -5,7 +5,7 @@ class JWKSetCache: - def __init__(self, lifespan: int) -> None: + def __init__(self, lifespan: float) -> None: self.jwk_set_with_timestamp: Optional[PyJWTSetWithTimestamp] = None self.lifespan = lifespan diff --git a/jwt/jwks_client.py b/jwt/jwks_client.py index d9304a2d..120eb256 100644 --- a/jwt/jwks_client.py +++ b/jwt/jwks_client.py @@ -20,9 +20,9 @@ def __init__( cache_keys: bool = False, max_cached_keys: int = 16, cache_jwk_set: bool = True, - lifespan: int = 300, + lifespan: float = 300, headers: Optional[Dict[str, Any]] = None, - timeout: int = 30, + timeout: float = 30, ssl_context: Optional[SSLContext] = None, ): if headers is None: