From f74fe64d8b6335e4471d3af347cb4b3dabc6c108 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Fri, 24 Aug 2018 18:29:05 +0000 Subject: [PATCH] publish muk_utils - 11.0 --- muk_utils/tools/http.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/muk_utils/tools/http.py b/muk_utils/tools/http.py index 42ea4aa..a444583 100644 --- a/muk_utils/tools/http.py +++ b/muk_utils/tools/http.py @@ -57,19 +57,18 @@ def get_response(url): response = session.post("%s%s" % (base_url, path), params) return response.status_code, response.headers, response.content except Exception as exception: + custom_cert = config.get("muk_custom_certificate", False) + _logger.info("Using Certificate: {}".format(custom_cert)) try: - custom_cert = config.get("muk_custom_certificate", False) - _logger.info("Using Certificate: {}".format(custom_cert)) + response = session.post("%s%s" % (base_url, path), params, verify=custom_cert) + return response.status_code, response.headers, response.reason + except Exception as e: try: - response = session.post("%s%s" % (base_url, path), params, verify=custom_cert) + response = session.post("%s%s" % (base_url, path), params, verify=False) return response.status_code, response.headers, response.reason except Exception as e: - try: - 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) + _logger.exception("Request failed!") + return 501, [], str(e) else: try: response = requests.get(url)