X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c314a3092c5b51c7782015f6fa9ac093b46fa174..1a64c3bfcd6f46506b7101d9943dbc297be25f10:/src/nominatim_db/utils/url_utils.py diff --git a/src/nominatim_db/utils/url_utils.py b/src/nominatim_db/utils/url_utils.py index eb56f72e..e3446dc9 100644 --- a/src/nominatim_db/utils/url_utils.py +++ b/src/nominatim_db/utils/url_utils.py @@ -7,7 +7,7 @@ """ Helper functions for accessing URL. """ -from typing import IO +from typing import IO # noqa import logging import urllib.request as urlrequest @@ -15,6 +15,7 @@ from ..version import NOMINATIM_VERSION LOG = logging.getLogger() + def get_url(url: str) -> str: """ Get the contents from the given URL and return it as a UTF-8 string. @@ -24,7 +25,7 @@ def get_url(url: str) -> str: try: request = urlrequest.Request(url, headers=headers) - with urlrequest.urlopen(request) as response: # type: IO[bytes] + with urlrequest.urlopen(request) as response: # type: IO[bytes] return response.read().decode('utf-8') except Exception: LOG.fatal('Failed to load URL: %s', url)