aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2019-09-02 13:27:44 +0100
committerGravatar jesopo2019-09-02 13:27:44 +0100
commit9cc1ee98ebbfd4fbcb13329cbf73e1f842b17483 (patch)
treefba3e813aad4dbe677dde50256570c4d8a188e6e
parentuse \S+ for url regex (for non-ascii chars), use url_sanitize to catch <> (diff)
signature
Pass the content of a webpage to HTTPParsingException
-rw-r--r--src/utils/http.py4
1 files changed, 2 insertions, 2 deletions
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)