urllib.URLopener¶
-
class
urllib.URLopener(proxies=None, context=None, **x509)[source]¶ Class to open URLs. This is a class rather than just a subroutine because we may need more than one set of global protocol-specific options. Note – this is a base class for those who don’t want the automatic handling of errors type 302 (relocated) and 401 (authorization needed).
Methods¶
__del__() |
|
__init__([proxies, context]) |
|
addheader(*args) |
Add a header to be used by the HTTP interface only e.g. |
cleanup() |
|
close() |
|
http_error(url, fp, errcode, errmsg, headers) |
Handle http errors. |
http_error_default(url, fp, errcode, errmsg, ...) |
Default error handler: close the connection and raise IOError. |
open(fullurl[, data]) |
Use URLopener().open(file) instead of open(file, ‘r’). |
open_data(url[, data]) |
Use “data” URL. |
open_file(url) |
Use local file or FTP depending on form of URL. |
open_ftp(url) |
Use FTP protocol. |
open_http(url[, data]) |
Use HTTP protocol. |
open_https(url[, data]) |
Use HTTPS protocol. |
open_local_file(url) |
Use local file. |
open_unknown(fullurl[, data]) |
Overridable interface to open unknown URL type. |
open_unknown_proxy(proxy, fullurl[, data]) |
Overridable interface to open unknown URL type. |
retrieve(url[, filename, reporthook, data]) |
retrieve(url) returns (filename, headers) for a local object |