File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,8 @@ def __init__(self,
123123 service_url = None ,
124124 service_port = None ,
125125 btc_conf_file = None ,
126- timeout = DEFAULT_HTTP_TIMEOUT ):
126+ timeout = DEFAULT_HTTP_TIMEOUT ,
127+ connection = None ):
127128
128129 # Create a dummy connection early on so if __init__() fails prior to
129130 # __conn being created __del__() can detect the condition and handle it
@@ -204,8 +205,11 @@ def __init__(self,
204205 authpair = authpair .encode ('utf8' )
205206 self .__auth_header = b"Basic " + base64 .b64encode (authpair )
206207
207- self .__conn = httplib .HTTPConnection (self .__url .hostname , port = port ,
208- timeout = timeout )
208+ if connection :
209+ self .__conn = connection
210+ else :
211+ self .__conn = httplib .HTTPConnection (self .__url .hostname , port = port ,
212+ timeout = timeout )
209213
210214 def _call (self , service_name , * args ):
211215 self .__id_count += 1
You can’t perform that action at this time.
0 commit comments