From 2709862e206ee7ec8b773477964656fead534063 Mon Sep 17 00:00:00 2001 From: barneygale Date: Thu, 24 Oct 2024 17:38:45 +0100 Subject: [PATCH] Stop using deprecated `urllib.request.URLopener` This was deprecated in Python 3.3. Fixes #157 --- wagon.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wagon.py b/wagon.py index e686acc..0b7678f 100644 --- a/wagon.py +++ b/wagon.py @@ -39,11 +39,11 @@ try: import urllib.error from urllib.request import urlopen - from urllib.request import URLopener + from urllib.request import urlretrieve except ImportError: import urllib from urllib import urlopen - from urllib import URLopener + from urllib import urlretrieve try: from distro import linux_distribution @@ -320,8 +320,7 @@ def _download_file(url, destination): final_url = response.geturl() if final_url != url and is_verbose(): logger.debug('Redirected to %s', final_url) - f = URLopener() - f.retrieve(final_url, destination) + urlretrieve(final_url, destination) def _http_request(url):