Skip to content

Instantly share code, notes, and snippets.

@dawn360
Last active February 23, 2017 17:16
Show Gist options
  • Save dawn360/334baa7cbedf93775fcef4189276d8e1 to your computer and use it in GitHub Desktop.
Save dawn360/334baa7cbedf93775fcef4189276d8e1 to your computer and use it in GitHub Desktop.
xmlrpc set timeout with custom transport
import http.client
import xmlrpc.client
class TimedTransport(xmlrpc.client.Transport):
timeout = 30
def set_timeout(self, timeout):
self.timeout = timeout
def make_connection(self, host):
connection = http.client.HTTPConnection(host, timeout=self.timeout)
self._connection = host, connection
return connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment