I'm currently writing a script that downloads a file from a URL
import urllib.request
urllib.request.urlretrieve(my_url, 'my_filename')
The docs urllib.request.urlretrieve
state:
The following functions and classes are ported from the Python 2 module urllib (as opposed to urllib2). They might become deprecated at some point in the future.
Therefore I would like to avoid it so I don't have to rewrite this code in the near future.
I'm unable to find another interface like download(url, filename)
in standard libraries. If urlretrieve
is considered a legacy interface in Python 3, what is the replacement?