O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required