def _send_request(self, uri, method, headers=None, body=None):
"""Do send request to target URL and validate SSL cert by default.
If validation failed, disable it and try again."""
if self._connection is None:
self._connection = self._build_http_connection(
proxy_info=self._proxy_info,
disable_ssl_cert_validation=False)
try:
return self._connection.request(
uri, body=body, method=method, headers=headers
)
except SSLHandshakeError:
_logger.warning(
"[SSL: CERTIFICATE_VERIFY_FAILED] certificate verification failed. "
"The certificate of the https server [%s] is not trusted, "
"this add-on will proceed to connect with this certificate. "
"You may need to check the certificate and "
"refer to the documentation and add it to the trust list. %s",
uri,
traceback.format_exc()
)
self._connection = self._build_http_connection(
proxy_info=self._proxy_info,
disable_ssl_cert_validation=True
)
return self._connection.request(
uri, body=body, method=method, headers=headers
)
评论列表
文章目录