Log HTTP Response Error Message on failed requests

This commit is contained in:
Cameron Yick
2017-09-10 22:23:02 -04:00
parent 832d24c01d
commit a24f430f55

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
import logging
import requests
from requests.exceptions import HTTPError
@@ -50,6 +52,7 @@ class RestClient(object):
try:
resp.raise_for_status()
except HTTPError as e:
logging.error(resp.content)
raise RestClientError(e)
return resp