PyDocs

Nav

Internet Protocols and Support

urlretrieve

urllib.request

function (source) not WASI
  • urlretrieve(url, filename=None, reporthook=None, data=None)
Retrieve a URL into a temporary location on disk.

Requires a URL argument. If a filename is passed, it is used as
the temporary file location. The reporthook argument should be
a callable that accepts a block number, a read size, and the
total file size of the URL target. The data argument should be
valid URL encoded data.

If a filename is passed and the URL points to a local resource,
the result is a copy from local file to new file.

Returns a tuple containing the path to the newly created
data file as well as the resulting HTTPMessage object.
1 Example
>>> import urllib.request
>>> local_filename, headers = urllib.request.urlretrieve('https://python.org/')
>>> html = open(local_filename)
>>> html.close()
from the Python docs
See Also
No see-alsos for urllib.request/urlretrieve
0 Notes
No notes for urlretrieve