I have this request:
import urllib2
f = urllib2.urlopen('http://www.python.org/')
print f.read(100)
but when I run it in Python 2.7.1, I get the following error:
AttributeError: 'module' object has not attribute 'urlopen'
I have this request:
import urllib2
f = urllib2.urlopen('http://www.python.org/')
print f.read(100)
but when I run it in Python 2.7.1, I get the following error:
AttributeError: 'module' object has not attribute 'urlopen'
I think you're missing the Request:
import urllib2
r = urllib2.Request('https://www.python.org/')
u = urllib2.urlopen(r)
response = u.read()