diff --git a/networkapiclient/ApiGenericClient.py b/networkapiclient/ApiGenericClient.py index 32bf55a..e7005c5 100755 --- a/networkapiclient/ApiGenericClient.py +++ b/networkapiclient/ApiGenericClient.py @@ -72,12 +72,15 @@ def get(self, uri): request.raise_for_status() - return request.json() + try: + return request.json() + except: + return request except HTTPError: - error = request.json() + error = request self.logger.error(error) - raise NetworkAPIClientError(error.get('detail', '')) + raise NetworkAPIClientError(str(error)) finally: self.logger.info('URI: %s', uri) if request: