Skip to content

Commit c3c81e7

Browse files
committed
Merge branch 'v2' into ssl_verify
2 parents f61504d + a7395fc commit c3c81e7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ build/
1414
*.pyc
1515
*.tar.gz
1616
*.zip
17+
venv/

umapi_client/auth.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# SOFTWARE.
2020

2121
import datetime as dt
22+
import logging
2223
import time
2324

2425
import jwt # package name is PyJWT in setup
@@ -54,12 +55,13 @@ def __call__(self):
5455

5556

5657
class AccessRequest(object):
57-
def __init__(self, endpoint, api_key, client_secret, jwt_token):
58+
def __init__(self, endpoint, api_key, client_secret, jwt_token, ssl_verify):
5859
self.endpoint = endpoint
5960
self.api_key = api_key
6061
self.client_secret = client_secret
6162
self.jwt_token = jwt_token
6263
self.expiry = None
64+
self.ssl_verify = ssl_verify
6365

6466
def __call__(self):
6567
headers = {
@@ -72,7 +74,7 @@ def __call__(self):
7274
"jwt_token": self.jwt_token
7375
})
7476

75-
r = requests.post(self.endpoint, headers=headers, data=body)
77+
r = requests.post(self.endpoint, headers=headers, data=body, verify=self.ssl_verify)
7678
if r.status_code != 200:
7779
raise RuntimeError("Unable to authorize against {}:\n"
7880
"Response Code: {:d}, Response Text: {}\n"

umapi_client/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _get_auth(self, ims_host, ims_endpoint_jwt,
160160
else:
161161
with open(private_key_file, 'r') as private_key_stream:
162162
jwt = JWT(self.org_id, tech_acct_id, ims_host, api_key, private_key_stream)
163-
token = AccessRequest("https://" + ims_host + ims_endpoint_jwt, api_key, client_secret, jwt())
163+
token = AccessRequest("https://" + ims_host + ims_endpoint_jwt, api_key, client_secret, jwt(), self.ssl_verify)
164164
return Auth(api_key, token())
165165

166166
def status(self, remote=False):

0 commit comments

Comments
 (0)