Name
Request
Synopsis
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
,v
inheaders
.items( ):r
.add_header(k
,v
)
An instance r
of class
Request
supplies the following methods.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.