Skip to content
Snippets Groups Projects
Commit 1d7d9b61 authored by David Douard's avatar David Douard
Browse files

Log errors when fetching an url in SWHListerHttpTransport

parent 68eb727d
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ import random
from datetime import datetime
from email.utils import parsedate
from pprint import pformat
import logging
import requests
import xmltodict
......@@ -20,6 +21,9 @@ from .abstractattribute import AbstractAttribute
from .lister_base import FetchError
logger = logging.getLogger(__name__)
class SWHListerHttpTransport(abc.ABC):
"""Use the Requests library for making Lister endpoint requests.
......@@ -114,6 +118,7 @@ class SWHListerHttpTransport(abc.ABC):
else:
response = self.session.get(path, **params)
except requests.exceptions.ConnectionError as e:
logger.warning('Failed to fetch %s: %s', path, e)
raise FetchError(e)
else:
if response.status_code not in self.EXPECTED_STATUS_CODES:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment