def connect(self): httplib.HTTPConnection.connect(self) timeout = getattr(self, "_timeout", 0) if timeout: self.sock.settimeout(timeout)