Skip to content

Commit 03fbbb4

Browse files
authored
Allow request kwargs
Allow load_x509_cert and KEYS.load_from_url to accept kwargs to pass through to request
1 parent 0c75bc6 commit 03fbbb4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/jwkest/jwk.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def der_cert2rsa(der):
134134
return der2rsa(base64.b64decode(pem))
135135

136136

137-
def load_x509_cert(url, spec2key):
137+
def load_x509_cert(url, spec2key, *args, **kwargs):
138138
"""
139139
Get and transform a X509 cert into a key
140140
@@ -143,7 +143,7 @@ def load_x509_cert(url, spec2key):
143143
:return: List of 2-tuples (keytype, key)
144144
"""
145145
try:
146-
r = request("GET", url, allow_redirects=True)
146+
r = request("GET", url, allow_redirects=True, **kwargs)
147147
if r.status_code == 200:
148148
cert = str(r.text)
149149
try:
@@ -798,7 +798,7 @@ def dump_jwks(self):
798798

799799
return json.dumps({"keys": res})
800800

801-
def load_from_url(self, url, verify=True):
801+
def load_from_url(self, url, *args, **kwargs):
802802
"""
803803
Get and transform a JWKS into keys
804804
@@ -807,7 +807,9 @@ def load_from_url(self, url, verify=True):
807807
:return: list of keys
808808
"""
809809

810-
r = request("GET", url, allow_redirects=True, verify=verify)
810+
if 'verify' not in kwargs:
811+
kwargs['verify'] = True
812+
r = request("GET", url, allow_redirects=True, **kwargs)
811813
if r.status_code == 200:
812814
return self.load_jwks(r.text)
813815
else:

0 commit comments

Comments
 (0)