From 9a135847b987acb03ccfb0b703056dc4d22be9eb Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 20 Jul 2024 09:46:28 +0100 Subject: [PATCH] make the cert verification optional --- api-client/client.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api-client/client.py b/api-client/client.py index 7b771ca..a2f0c0b 100644 --- a/api-client/client.py +++ b/api-client/client.py @@ -4,7 +4,7 @@ from requests import RequestException from requests_oauthlib import OAuth2Session -def api_client(call_dict): +def api_client(call_dict, verify_cert=False): url = call_dict["url"] headers = call_dict["headers"] @@ -15,15 +15,15 @@ def api_client(call_dict): try: if method == 'GET': - response = client.get(url, headers=headers, params=body, verify=False) + response = client.get(url, headers=headers, params=body, verify=verify_cert) elif method == 'POST': - response = client.post(url, headers=headers, json=body, verify=False) + response = client.post(url, headers=headers, json=body, verify=verify_cert) elif method == 'PUT': - response = client.put(url, headers=headers, json=body, verify=False) + response = client.put(url, headers=headers, json=body, verify=verify_cert) elif method == 'OPTIONS': - response = client.options(url, headers=headers, json=body, verify=False) + response = client.options(url, headers=headers, json=body, verify=verify_cert) elif method == 'DELETE': - response = client.delete(url, verify=False) + response = client.delete(url, verify=verify_cert) else: raise ValueError(f"Invalid method: {method}")