使用urllib发http请求时:
import urllib, httplib httplib.HTTPConnection.debuglevel = 1 urllib.urlopen()
|
使用urllib2发http请求时:
import urllib2 handler=urllib2.HTTPHandler(debuglevel=1) opener = urllib2.build_opener(handler) urllib2.install_opener(opener) request = urllib2.Request(url,headers,data)
|
debuglevel设置微1可以查看header、body等内容
阅读(1974) | 评论(0) | 转发(0) |