From 9cc1ee98ebbfd4fbcb13329cbf73e1f842b17483 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 2 Sep 2019 13:27:44 +0100 Subject: Pass the content of a webpage to HTTPParsingException --- src/utils/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/utils/http.py b/src/utils/http.py index e4ec5fe9..d63a99cc 100644 --- a/src/utils/http.py +++ b/src/utils/http.py @@ -41,7 +41,7 @@ class HTTPTimeoutException(HTTPException): def __init__(self): Exception.__init__(self, "HTTP request timed out") class HTTPParsingException(HTTPException): - def __init__(self, message: str=None): + def __init__(self, message: str, data: str=None): Exception.__init__(self, message or "HTTP parsing failed") class HTTPWrongContentTypeException(HTTPException): def __init__(self, message: str=None): @@ -112,7 +112,7 @@ def request(url: str, method: str="GET", get_params: dict={}, return Response(response.status_code, _json.loads(data), response_headers) except _json.decoder.JSONDecodeError as e: - raise HTTPParsingException(str(e)) + raise HTTPParsingException(str(e), data) return Response(response.status_code, data, response_headers) -- cgit v1.3.1-10-gc9f91