Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有下面的请求,它工作正常,但它返回发送的请求和服务器的完整响应。我怎样才能得到响应体?
req = urllib2.Request('some url here', data = '') opener = urllib2.build_opener(urllib2.HTTPSHandler(debuglevel = 1)) req = opener.open(req) reply = req.read() req.close() print reply
使用 . 明确请求该额外信息debuglevel=1。您可以简单地删除它,甚至整个开瓶器定义,如下所示:
debuglevel=1
import urllib2 print (urllib2.urlopen('https://phihag.de/').read())