diff --git a/test/test_interceptor.py b/test/test_interceptor.py index de0e9ca..05c10e4 100644 --- a/test/test_interceptor.py +++ b/test/test_interceptor.py @@ -11,7 +11,11 @@ import py.test import requests import urllib3 from httplib2 import Http, ServerNotFoundError -from six.moves import http_client +# don't use six as the monkey patching gets confused +try: + import http.client as http_client +except ImportError: + import httplib as http_client from six.moves.urllib.request import urlopen from six.moves.urllib.error import URLError diff --git a/wsgi_intercept/http_client_intercept.py b/wsgi_intercept/http_client_intercept.py index c7f9ca8..56d930c 100644 --- a/wsgi_intercept/http_client_intercept.py +++ b/wsgi_intercept/http_client_intercept.py @@ -19,16 +19,13 @@ except ImportError: HTTPSConnection as OriginalHTTPSConnection ) -HTTPInterceptorMixin = WSGI_HTTPConnection -HTTPSInterceptorMixin = WSGI_HTTPSConnection - -class HTTP_WSGIInterceptor(HTTPInterceptorMixin, http_lib.HTTPConnection): +class HTTP_WSGIInterceptor(WSGI_HTTPConnection, http_lib.HTTPConnection): pass -class HTTPS_WSGIInterceptor(HTTPSInterceptorMixin, http_lib.HTTPSConnection, - HTTP_WSGIInterceptor): +class HTTPS_WSGIInterceptor(WSGI_HTTPSConnection, http_lib.HTTPSConnection, + HTTP_WSGIInterceptor): def __init__(self, host, **kwargs): self.host = host