Log errors when fetching an url in SWHListerHttpTransport
This commit is contained in:
parent
68eb727d6a
commit
1d7d9b6128
1 changed files with 5 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue