URLopener and FancyURLopener objects have the following attributes.
fullurl[, data]) |
fullurl[, data]) |
url[, filename[, reporthook[, data]]]) |
None
(for local URLs). The caller must then open and read the
contents of filename. If filename is not given and the URL
refers to a local file, the input filename is returned. If the URL is
non-local and filename is not given, the filename is the output of
tempfile.mktemp() with a suffix that matches the suffix of the last
path component of the input URL. If reporthook is given, it must be
a function accepting three numeric parameters. It will be called after each
chunk of data is read from the network. reporthook is ignored for
local URLs.
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.
The FancyURLopener class offers one additional method that should be overloaded to provide the appropriate behavior:
host, realm) |
(user, password)
, which can be used for basic
authentication.
The implementation prompts for this information on the terminal; an application should override this method to use an appropriate interaction model in the local environment.
See About this document... for information on suggesting changes.