Skip to content

Commit 1ed82fa

Browse files
authored
Merge pull request #81 from zulrang/zulrang-request-kwargs
Allow request kwargs
2 parents cf2c74e + 03fbbb4 commit 1ed82fa

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
@@ -143,7 +143,7 @@ def der_cert2rsa(der):
143143
return der2rsa(base64.b64decode(pem))
144144

145145

146-
def load_x509_cert(url, spec2key):
146+
def load_x509_cert(url, spec2key, *args, **kwargs):
147147
"""
148148
Get and transform a X509 cert into a key
149149
@@ -152,7 +152,7 @@ def load_x509_cert(url, spec2key):
152152
:return: List of 2-tuples (keytype, key)
153153
"""
154154
try:
155-
r = request("GET", url, allow_redirects=True)
155+
r = request("GET", url, allow_redirects=True, **kwargs)
156156
if r.status_code == 200:
157157
cert = str(r.text)
158158
try:
@@ -836,7 +836,7 @@ def dump_jwks(self):
836836

837837
return json.dumps({"keys": res})
838838

839-
def load_from_url(self, url, verify=True):
839+
def load_from_url(self, url, *args, **kwargs):
840840
"""
841841
Get and transform a JWKS into keys
842842
@@ -845,7 +845,9 @@ def load_from_url(self, url, verify=True):
845845
:return: list of keys
846846
"""
847847

848-
r = request("GET", url, allow_redirects=True, verify=verify)
848+
if 'verify' not in kwargs:
849+
kwargs['verify'] = True
850+
r = request("GET", url, allow_redirects=True, **kwargs)
849851
if r.status_code == 200:
850852
return self.load_jwks(r.text)
851853
else:

0 commit comments

Comments
 (0)