summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2019-03-04 17:37:25 +1100
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-07-29 10:12:59 +0200
commit41452daf531eccc45d22bb1a4630ca6a270da862 (patch)
tree726b435951f416ad9f7fe9bec221db2c1b4c4d1b /lib
parent6e7da2121628be7d18a9af3dd087c78b2a0fc2b7 (diff)
Use urllib urllib instead of urllib2
Diffstat (limited to 'lib')
-rw-r--r--lib/python/debian_support.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py
index 00ffc89a58..a8a2c0ffed 100644
--- a/lib/python/debian_support.py
+++ b/lib/python/debian_support.py
@@ -25,7 +25,10 @@ import re
import sys
import tempfile
import types
-import urllib2
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
from cStringIO import StringIO
try:
@@ -291,7 +294,7 @@ def downloadGunzipLines(remote):
Returns the lines in the file."""
- data = urllib2.urlopen(remote, timeout=TIMEOUT)
+ data = urlopen(remote, timeout=TIMEOUT)
try:
gfile = gzip.GzipFile(fileobj=StringIO(data.read()))
try:
@@ -336,7 +339,7 @@ def updateFile(remote, local, verbose=None):
re_whitespace=re.compile('\s+')
try:
- index_url = urllib2.urlopen(index_name, timeout=TIMEOUT)
+ index_url = urlopen(index_name, timeout=TIMEOUT)
index_fields = list(PackageFile(index_name, index_url))
except ParseError:
if verbose:

© 2014-2024 Faster IT GmbH | imprint | privacy policy