src/ztfy/utils/protocol/xmlrpc.py
branchZTK-1.1
changeset 248 3d4f38808370
parent 223 85a03fd95686
child 265 06d455f32dd5
--- a/src/ztfy/utils/protocol/xmlrpc.py	Fri Jan 17 13:28:49 2014 +0100
+++ b/src/ztfy/utils/protocol/xmlrpc.py	Wed May 07 19:03:31 2014 +0200
@@ -191,10 +191,15 @@
     return xmlrpclib.Server(uri, transport=transport, verbose=verbose, allow_none=allow_none)
 
 
-def getClientWithCookies(uri, credentials=(), verbose=False, allow_none=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, headers=None):
+def getClientWithCookies(uri, credentials=(), verbose=False, allow_none=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
+                         headers=None, cookies=None):
     """Get an XML-RPC client which supports authentication through cookies"""
+    if cookies is None:
+        cookies = cookielib.CookieJar()
     if uri.startswith('https:'):
-        transport = SecureXMLRPCCookieAuthTransport('Python XML-RPC Client/0.1 (ZTFY secure cookie transport)', credentials, cookielib.CookieJar(), timeout, headers)
+        transport = SecureXMLRPCCookieAuthTransport('Python XML-RPC Client/0.1 (ZTFY secure cookie transport)',
+                                                    credentials, cookies, timeout, headers)
     else:
-        transport = XMLRPCCookieAuthTransport('Python XML-RPC Client/0.1 (ZTFY basic cookie transport)', credentials, cookielib.CookieJar(), timeout, headers)
+        transport = XMLRPCCookieAuthTransport('Python XML-RPC Client/0.1 (ZTFY basic cookie transport)',
+                                              credentials, cookies, timeout, headers)
     return xmlrpclib.Server(uri, transport=transport, verbose=verbose, allow_none=allow_none)