<s> """<STR_LIT>""" <EOL> try : <EOL> import http . client as http_lib <EOL> except ImportError : <EOL> import httplib as http_lib <EOL> from . import WSGI_HTTPConnection , WSGI_HTTPSConnection <EOL> try : <EOL> from http . client import ( <EOL> HTTPConnection as OriginalHTTPConnection , <EOL> HTTPSConnection as OriginalHTTPSConnection <EOL> ) <EOL> except ImportError : <EOL> from httplib import ( <EOL> HTTPConnection as OriginalHTTPConnection , <EOL> HTTPSConnection as OriginalHTTPSConnection <EOL> ) <EOL> HTTPInterceptorMixin = WSGI_HTTPConnection <EOL> HTTPSInterceptorMixin = WSGI_HTTPSConnection <EOL> class HTTP_WSGIInterceptor ( HTTPInterceptorMixin , http_lib . HTTPConnection ) : <EOL> pass <EOL> class HTTPS_WSGIInterceptor ( HTTPSInterceptorMixin , http_lib . HTTPSConnection , <EOL> HTTP_WSGIInterceptor ) : <EOL> def __init__ ( self , host , ** kwargs ) : <EOL> self . host = host <EOL> try : <EOL> self . port = kwargs [ '<STR_LIT:port>' ] <EOL> except KeyError : <EOL> self . port = None <EOL> HTTP_WSGIInterceptor . __init__ ( self , host , ** kwargs ) <EOL> def install ( ) : <EOL> http_lib . HTTPConnection = HTTP_WSGIInterceptor <EOL> http_lib . HTTPSConnection = HTTPS_WSGIInterceptor <EOL> def uninstall ( ) : <EOL> http_lib . HTTPConnection = OriginalHTTPConnection <EOL> http_lib . HTTPSConnection = OriginalHTTPSConnection </s>
