本文整理汇总了Python中httplib.HTTP.debuglevel方法的典型用法代码示例。如果您正苦于以下问题:Python HTTP.debuglevel方法的具体用法?Python HTTP.debuglevel怎么用?Python HTTP.debuglevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类httplib.HTTP
的用法示例。
在下文中一共展示了HTTP.debuglevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from httplib import HTTP [as 别名]
# 或者: from httplib.HTTP import debuglevel [as 别名]
('Accept', 'application/x-dvi, application/postscript, video/*, video/mpeg, image/*, audio/*, application/applefile, application/x-metamail-patch, sun-deskset-message, mail-file, default, postscript-file, audio-file, x-sun-attachment, text/enriched, text/richtext, application/andrew-inset, x-be2, application/postscript, message/external-body, message/partial, image/x-xwd, image/gif, image/*, image/jpeg, audio/basic, audio/*, text/html, text/plain, application/x-wais-source, application/html, video/mpeg, image/jpeg, image/x-tiff, image/x-rgb, image/x-png, image/x-xbm, image/gif, application/postscript, */*;q=0.001'),
('Accept-Encoding', 'gzip, compress'),
('Accept-Language', 'en'),
('Pragma', 'no-cache'),
('Cache-Control', 'no-cache'),
('User-Agent', 'Lynx/2.6 libwww-FM/2.14'),
('From', '"a-fan" <[email protected]>'),
('Referer', 'http://www.comcentral.com/mst/mstpoll.htm'),
('Content-type', 'application/x-www-form-urlencoded'),
('Content-length', '8')]
text='vote=' + str(episode)
n = n - 1
h = HTTP('www.comcentral.com')
h.debuglevel = 1
h.putrequest('POST', '/cgi-bin/rbox/pollboy.pl')
for (hn, hv) in headers:
if (hn == 'From'):
hv = 'user' + str(n) + '@blah.com'
h.putheader(hn, hv)
#print "hn:", hn, "hv:", hv
h.endheaders()
h.send(text)
errcode, errmsg, headers = h.getreply()
if errcode == 200:
f = h.getfile()
print f.read() # Print the raw HTML