urllib

The urllib module is used to fetch data from the Web. This module is relatively simple and easy to use. However, if you need more advanced capabilities, such as dealing with cookies or user authentication, you should use the urllib2 module instead.

						urlopen(url
						[,
						data])

Given the uniform resource locator url, such as ‘http://www.python.org’ or ‘ftp://foo.com/pub/foo.tar’, this function opens a network connection and returns a file-like object. If the URL doesn’t have a scheme identifier such as ftp: or http:, or if it’s file:, a local file is opened. If a connection cannot be made or an error occurs, an IOError exception is raised. If the URL is an HTTP request, the optional data argument specifies that the request should be made using ...

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.