Browse Source

publish muk_utils - 11.0

pull/6/head
MuK IT GmbH 6 years ago
parent
commit
6e2fb8f770
  1. 9
      muk_utils/tools/http.py

9
muk_utils/tools/http.py

@ -58,7 +58,14 @@ def get_response(url):
return response.status_code, response.headers, response.content return response.status_code, response.headers, response.content
except requests.exceptions.RequestException as exception: except requests.exceptions.RequestException as exception:
try: 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: except Exception as e:
_logger.exception("Request failed!") _logger.exception("Request failed!")
return 501, [], str(e) return 501, [], str(e)

Loading…
Cancel
Save