def __init__(self, timeout=None, scheme='http'): SafeTransport.__init__(self) transport_class = Transport if scheme == 'http' else SafeTransport def make_connection(*args, **kw): connection = transport_class.make_connection(self, *args, **kw) if timeout is not None: connection.timeout = timeout return connection self.make_connection = make_connection
def make_connection(self, host): c = SafeTransport.make_connection(self, host) c.timeout = self.timeout return c
def __init__(self, timeout, *args, **kwargs): SafeTransport.__init__(self, *args, **kwargs) self.timeout = timeout
def send_content(self, connection, request_body): try: return SafeTransport.send_content(self, connection, request_body) except socket.error: raise ProtocolError(connection.host, -1, "Could not connect to server", None)