This module provides a high-level interface for fetching data across the World-Wide Web. In particular, the urlopen() function is similar to the built-in function open(), but accepts Universal Resource Locators (URLs) instead of filenames. Some restrictions apply -- it can only open URLs for reading, and no seek operations are available.
It defines the following public functions:
Except for the info() method, these methods have the same interface as for file objects -- see section 2.1 in this manual. (It is not a built-in file object, however, so it can't be used at those few places where a true built-in file object is required.)
The info() method returns an instance of the class mimetools.Message containing the headers received from the server, if the protocol uses such headers (currently the only supported protocol that uses this is HTTP). See the description of the mimetools module.
If the url uses the "http:" scheme identifier, the optional data argument may be given to specify a POST request (normally the request type is GET). The data argument must in standard "application/x-www-form-urlencoded" format; see the urlencode() function below.
Example: quote('/connolly/') yields '/%7econnolly/'.
Example: unquote('/%7Econnolly/') yields '/connolly/'.
Restrictions: