11import  requests 
22
33try :
4-   from  urllib .parse  import  urlencode , unquote 
4+      from  urllib .parse  import  urlencode , unquote 
55except  ImportError :
6-   from  urllib  import  urlencode , unquote 
6+      from  urllib  import  urlencode , unquote 
77import  json 
88
99
1010class  Client (object ):
11-     def  __init__ (self , url , params = {} , options = {} ):
11+     def  __init__ (self , url , params = None , options = None ):
1212        """ 
1313        Initialises a new Client object 
1414
@@ -18,6 +18,8 @@ def __init__(self, url, params={}, options={}):
1818        :param options: Dictionary that can contain the port of an existing 
1919                        proxy to use (for example 'existing_proxy_port_to_use') 
2020        """ 
21+         params  =  params  if  params  is  not   None  else  {}
22+         options  =  options  if  options  is  not   None  else  {}
2123        self .host  =  "http://"  +  url 
2224        if  params :
2325            urlparams  =  "?"  +  unquote (urlencode (params ))
@@ -97,7 +99,7 @@ def har(self):
9799        return  r .json ()
98100
99101
100-     def  new_har (self , ref = None , options = {} ):
102+     def  new_har (self , ref = None , options = None ):
101103        """ 
102104        This sets a new HAR to be recorded 
103105
@@ -109,6 +111,8 @@ def new_har(self, ref=None, options={}):
109111                    captureContent - Boolean, capture content bodies \ 
110112                    captureBinaryContent - Boolean, capture binary content
111113        """ 
114+         options  =  options  if  options  is  not   None  else  {}
115+ 
112116        if  ref :
113117            payload  =  {"initialPageRef" : ref }
114118        else :
@@ -281,15 +285,15 @@ def timeouts(self, options):
281285                         params )
282286        return  r .status_code 
283287
284-     def  remap_hosts (self , address = None , ip_address = None , hostmap = {} ):
288+     def  remap_hosts (self , address = None , ip_address = None , hostmap = None ):
285289        """ 
286290        Remap the hosts for a specific URL 
287291
288292        :param address: url that you wish to remap 
289293        :param ip_address: IP Address that will handle all traffic for the address passed in 
290294        :param **hostmap: Other hosts to be added as keyword arguments 
291295        """ 
292- 
296+          hostmap   =   hostmap   if   hostmap   is   not   None   else  {} 
293297        if  (address  is  not   None  and  ip_address  is  not   None ):
294298            hostmap [address ] =  ip_address 
295299
0 commit comments