File tree Expand file tree Collapse file tree 5 files changed +12
-1
lines changed Expand file tree Collapse file tree 5 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 41
41
}
42
42
43
43
JWT_HEADERS = ["typ" , "cty" ]
44
+ DEFAULT_HTTPC_TIMEOUT = 10
Original file line number Diff line number Diff line change 16
16
from cryptojwt .jwk .hmac import new_sym_key
17
17
from cryptojwt .jwk .x509 import import_private_key_from_pem_file
18
18
19
+ from . import DEFAULT_HTTPC_TIMEOUT
19
20
from .exception import JWKException
20
21
from .exception import UnknownKeyType
21
22
from .exception import UnsupportedAlgorithm
@@ -254,6 +255,8 @@ def __init__(
254
255
self .httpc = requests .request
255
256
256
257
self .httpc_params = httpc_params or {}
258
+ if not self .httpc_params .get ("timeout" ):
259
+ self .httpc_params ["timeout" ] = DEFAULT_HTTPC_TIMEOUT
257
260
258
261
if keys :
259
262
self .source = None
Original file line number Diff line number Diff line change 6
6
7
7
from requests import request
8
8
9
+ from . import DEFAULT_HTTPC_TIMEOUT
9
10
from .jwe .utils import alg2keytype as jwe_alg2keytype
10
11
from .jws .utils import alg2keytype as jws_alg2keytype
11
12
from .key_bundle import KeyBundle
@@ -58,6 +59,8 @@ def __init__(
58
59
self .ca_certs = ca_certs
59
60
self .httpc = httpc or request
60
61
self .httpc_params = httpc_params or {}
62
+ if not self .httpc_params .get ("timeout" ):
63
+ self .httpc_params ["timeout" ] = DEFAULT_HTTPC_TIMEOUT
61
64
self .keybundle_cls = keybundle_cls
62
65
self .name = name
63
66
self .remove_after = remove_after
Original file line number Diff line number Diff line change 5
5
6
6
from requests import request
7
7
8
+ from . import DEFAULT_HTTPC_TIMEOUT
8
9
from .exception import IssuerNotFound
9
10
from .jwe .jwe import alg2keytype as jwe_alg2keytype
10
11
from .jws .utils import alg2keytype as jws_alg2keytype
@@ -51,6 +52,9 @@ def __init__(
51
52
self .remove_after = remove_after
52
53
self .httpc = httpc or request
53
54
self .httpc_params = httpc_params or {}
55
+ if not self .httpc_params .get ("timeout" ):
56
+ self .httpc_params ["timeout" ] = DEFAULT_HTTPC_TIMEOUT
57
+
54
58
# Now part of httpc_params
55
59
# self.verify_ssl = verify_ssl
56
60
if not self .httpc_params : # backward compatibility
Original file line number Diff line number Diff line change @@ -774,7 +774,7 @@ def test_localhost_url():
774
774
775
775
kb = issuer .find (url )
776
776
assert len (kb ) == 1
777
- assert kb [0 ].httpc_params == {"verify" : False }
777
+ assert kb [0 ].httpc_params == {"timeout" : 10 , " verify" : False }
778
778
779
779
780
780
def test_add_url ():
You can’t perform that action at this time.
0 commit comments