An alternative implementation that will be compatible with python 2.7 will be as follows (with a comment containing what you want if using python 2.6):
import socket import xmlrpclib class TimeoutTransport (xmlrpclib.Transport): """ Custom XML-RPC transport class for HTTP connections, allowing a timeout in the base connection. """ def __init__(self, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, use_datetime=0): xmlrpclib.Transport.__init__(self, use_datetime) self._timeout = timeout def make_connection(self, host):
Using the super-method will allow the main implementation of 2.7 to support its supporting HTTP / 1.1 keep-alive functionality.
It should be noted that if you are trying to use XML-RPC through an https connection / address, replace the xmlrpc.SafeTransport links with xmlrpc.Transport instead and if you are using the 2.6 implementation, use httplib.HTTPSConnection .
source share