Reputation: 5078
I've the request below which works fine but it returns sent request and server full response. How can I just get response body ?
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
Upvotes: 0
Views: 75
Reputation: 287885
That extra information is explicitly requested with debuglevel=1
. You can simply remove that, or even the whole opener definition, like this:
import urllib2
print (urllib2.urlopen('https://phihag.de/').read())
Upvotes: 1