aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2020-01-12 07:45:16 +0100
committerMatěj Cepl <mcepl@cepl.eu>2020-01-12 07:47:06 +0100
commit2292db10fce04fcca3efb806f9a578ad38166e18 (patch)
tree6629e5053db0dc0fd5afb754934a70fbba9c5f69
parent3178e4bd3a868f78ce9f1765e9562524e674307d (diff)
downloaddlp_check_version_PyPI-2292db10fce04fcca3efb806f9a578ad38166e18.tar.gz
Catch URLError when accessing network.
-rwxr-xr-xdlpcvp.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/dlpcvp.py b/dlpcvp.py
index 1802d0a..39cfcfc 100755
--- a/dlpcvp.py
+++ b/dlpcvp.py
@@ -11,7 +11,7 @@ import urllib.request
import xml.etree.ElementTree as ET
from distutils.version import LooseVersion
from typing import Iterable, List, Optional, Tuple, Union
-from urllib.error import HTTPError
+from urllib.error import URLError, HTTPError
from urllib.request import Request, urlopen
# PyPI API documentation https://warehouse.readthedocs.io/api-reference/
@@ -303,6 +303,11 @@ def main(prj):
except RuntimeError as ex:
log.warning(f'Package {pkg} cannot be found: {ex}')
continue
+ except URLError as ex:
+ log.warning(
+ 'Investigation of package %s caused network error: %s',
+ pkg, ex)
+ continue
try:
if pypi_ver > suse_ver: