From 6e2fb8f770e8a8a46f1f5eb86678fca330907a47 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Fri, 24 Aug 2018 18:01:14 +0000 Subject: [PATCH] publish muk_utils - 11.0 --- muk_utils/tools/http.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/muk_utils/tools/http.py b/muk_utils/tools/http.py index 3fe55e8..94c0315 100644 --- a/muk_utils/tools/http.py +++ b/muk_utils/tools/http.py @@ -58,7 +58,14 @@ def get_response(url): return response.status_code, response.headers, response.content except requests.exceptions.RequestException as exception: try: - return exception.response.status_code, exception.response.headers, exception.response.reason + custom_cert = config.get("muk_custom_certificate", False) + _logger.debug("Using Certificate: {}".format(custom_cert)) + try: + response = session.post("%s%s" % (base_url, path), params, verify=custom_cert) + return response.status_code, response.headers, response.reason + except Exception as e: + response = session.post("%s%s" % (base_url, path), params, verify=False) + return response.status_code, response.headers, response.reason except Exception as e: _logger.exception("Request failed!") return 501, [], str(e)