File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
supertokens_python/recipe/session Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111### Changes
1212
1313- Use ` useStaticSigningKey ` instead of ` use_static_signing_key ` in ` create_jwt ` function. This was a bug in the code.
14+ - Use request library instead of urllib to fetch JWKS keys ([ #344 ] ( https://github.com/supertokens/supertokens-python/issues/344 ) )
1415
1516
1617## [ 0.14.3] - 2023-06-7
Original file line number Diff line number Diff line change 11import json
2- import urllib . request
2+ import requests
33from typing import List , Optional
4- from urllib .error import URLError
54
65from jwt import PyJWK , PyJWKSet
76from jwt .api_jwt import decode_complete as decode_token # type: ignore
@@ -46,10 +45,11 @@ def __init__(
4645 def fetch (self ):
4746 try :
4847 log_debug_message ("Fetching jwk set from the configured uri" )
49- with urllib .request .urlopen (self .uri , timeout = self .timeout_sec ) as response :
48+ with requests .get (self .uri , timeout = self .timeout_sec ) as response :
49+ response .raise_for_status ()
5050 self .cached_jwks = PyJWKSet .from_dict (json .load (response )) # type: ignore
5151 self .last_fetch_time = get_timestamp_ms ()
52- except URLError :
52+ except requests . HTTPError :
5353 raise JWKSRequestError ("Failed to fetch jwk set from the configured uri" )
5454
5555 def is_cooling_down (self ) -> bool :
You can’t perform that action at this time.
0 commit comments