urllib2

The urllib2 module provides an extensible framework for opening URLs on the Internet. Unlike the urllib module, urllib2 is capable of handling more complicated connection scenarios, including those involving HTTP cookies, redirection, and password authorization.

urllib2 defines the following functions:

						urlopen(url
						[,
						data])

Opens the URL url and returns a file-like object that can be used to read the returned data. url may either be a string containing a URL or an instance of the Request class, described later. data is a URL-encoded string containing data to be uploaded to the server. When data is given, the HTTP ‘POST’ method is used instead of ‘GET’ (the default). Data is generally created using a function such as urllib.urlencode() ...

Get Python: Essential Reference, Third Edition 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.