Question about the wording in the python documents.
grocery_stocker
cdalten at gmail.com
Fri May 1 16:02:59 EDT 2009
At the following url...
http://docs.python.org/library/urllib2.html
They have the following...
"urllib2.urlopen(url[, data][, timeout])
Open the URL url, which can be either a string or a Request
object"
I don't get how urllib2.urlopen() can take a Request object. When I do
the following....
[cdalten at localhost ~]$ python
Python 2.4.3 (#1, Oct 1 2006, 18:00:19)
[GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>>
>>> url = 'http://www.google.com'
>>> req = urllib2.Request(url)
>>> response = urllib2.urlopen(req)
>>>
req is clearly an instance of urllib2.Request and not a Request object.
More information about the Python-list
mailing list