本文整理汇总了Python中eventlet.green.httplib.HTTPConnection.putheader方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPConnection.putheader方法的具体用法?Python HTTPConnection.putheader怎么用?Python HTTPConnection.putheader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eventlet.green.httplib.HTTPConnection
的用法示例。
在下文中一共展示了HTTPConnection.putheader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: http_connect
# 需要导入模块: from eventlet.green.httplib import HTTPConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPConnection import putheader [as 别名]
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
示例2: http_connect
# 需要导入模块: from eventlet.green.httplib import HTTPConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPConnection import putheader [as 别名]
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
示例3: putheader
# 需要导入模块: from eventlet.green.httplib import HTTPConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPConnection import putheader [as 别名]
def putheader(self, header, value):
if header.lower() == 'x-cf-trans-id':
self._txn_id = value
return HTTPConnection.putheader(self, header, value)