retrieve(url, filename=None, reporthook=None, data=None)
Retrieves the contents of url and places it in filename. The return value is a tuple consisting of a local filename and either an email.message.Message
object containing the response headers (for remote URLs) or 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: A chunk number, the maximum size chunks are read in and the total size of the download (-1 if unknown). It will be called once at the start and 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 urllib.parse.urlencode()
function.
Please login to continue.