Index: telemetry/third_party/webpagereplay/httpclient.py |
diff --git a/telemetry/third_party/webpagereplay/httpclient.py b/telemetry/third_party/webpagereplay/httpclient.py |
index adae0d07cf39ab27f3d29e8e603d1beaed442c08..88ee9f39f1d4a2a9a22193bb4db6b4279b544f84 100644 |
--- a/telemetry/third_party/webpagereplay/httpclient.py |
+++ b/telemetry/third_party/webpagereplay/httpclient.py |
@@ -186,8 +186,12 @@ class DetailedHTTPSConnection(httplib.HTTPSConnection): |
response_class = DetailedHTTPSResponse |
def __init__(self, host, port): |
- httplib.HTTPSConnection.__init__( |
- self, host=host, port=port, context=ssl._create_unverified_context()) |
+ # https://www.python.org/dev/peps/pep-0476/#opting-out |
+ if hasattr(ssl, '_create_unverified_context'): |
+ httplib.HTTPSConnection.__init__( |
+ self, host=host, port=port, context=ssl._create_unverified_context()) |
+ else: |
+ httplib.HTTPSConnection.__init__(self, host=host, port=port) |
class RealHttpFetch(object): |