Skip to content

Commit

Permalink
Stop using deprecated urllib.request.URLopener
Browse files Browse the repository at this point in the history
This was deprecated in Python 3.3.

Fixes cloudify-cosmo#157
  • Loading branch information
barneygale committed Oct 24, 2024
1 parent 6087bed commit 2709862
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions wagon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 2709862

Please sign in to comment.