"""
Helper functions for accessing URL.
"""
-from typing import IO
+from typing import IO # noqa
import logging
import urllib.request as urlrequest
LOG = logging.getLogger()
+
def get_url(url: str) -> str:
""" Get the contents from the given URL and return it as a UTF-8 string.
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)