From 379807bf0d3eea104ab94515ab8a7e87217cbd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 10 Jan 2017 20:39:40 +0100 Subject: [PATCH] Add workaround for platforms where injecting pyopenssl to urllib3 (#3990) fails with requests package (Ubuntu Trusty) --- acme/acme/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/acme/acme/client.py b/acme/acme/client.py index d041cc7d7..b5db57235 100644 --- a/acme/acme/client.py +++ b/acme/acme/client.py @@ -27,7 +27,11 @@ logger = logging.getLogger(__name__) # for SSL, which does allow these options to be configured. # https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning if sys.version_info < (2, 7, 9): # pragma: no cover - requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3() + try: + requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3() + except AttributeError: + import urllib3.contrib.pyopenssl # pylint: disable=import-error + urllib3.contrib.pyopenssl.inject_into_urllib3() DER_CONTENT_TYPE = 'application/pkix-cert'