March 2003
Intermediate to advanced
656 pages
39h 30m
English
Request
class Request(urlstring,data=None,headers={})
urlstring is the URL that this instance of
class Request embodies. For example, if there are
no data and
headers, calling:
urllib2.urlopen(urllib2.Request(urlstring))is just like calling:
urllib2.urlopen(urlstring)When data is not None,
the Request constructor implicitly calls on the
new instance r its method
r
.add_data(
data
).
headers must be a mapping of header names
to header values. The Request constructor executes
the equivalent of the loop:
fork,vinheaders.items( ):r.add_header(k,v)
An instance r of class
Request supplies the following methods.