def http_connect(host, method, path, headers=None): conn = HTTPConnection(host) conn.path = path conn.putrequest(method, path) if headers: for header, value in headers.iteritems(): conn.putheader(header, str(value)) conn.endheaders() return conn
def http_connect(host, method, path, headers=None): conn = HTTPConnection(host) conn.path = path conn.putrequest(method, path) if headers: for header, value in headers.items(): if isinstance(value, (list, tuple)): for k in value: conn.putheader(header, str(k)) else: conn.putheader(header, str(value)) conn.endheaders() return conn
def putheader(self, header, value): if not isinstance(header, bytes): header = header.encode('latin-1') HTTPConnection.putheader(self, header, value)
def putheader(self, header, value): if header.lower() == 'x-cf-trans-id': self._txn_id = value return HTTPConnection.putheader(self, header, value)