From 625c2c2af045798a7fc0a0b40a4b63a990c00bb2 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 24 Jan 2023 17:21:33 +0100 Subject: [PATCH] Fix except message --- commands/pygg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/pygg.py b/commands/pygg.py index 1af6a17..b523a68 100755 --- a/commands/pygg.py +++ b/commands/pygg.py @@ -54,7 +54,7 @@ class FlareRequests(requests.Session): content = response.json() - if "solution" in content: + if "solution" in content and content["solution"]: solution = content["solution"] raw = solution["response"].encode() encoding = charset_normalizer.detect(raw) @@ -70,14 +70,14 @@ class FlareRequests(requests.Session): return resolved - raise requests.RequestException(response) + raise requests.RequestException(content["message"], response=response) except requests.RequestException: session = requests.post( FLARE_ENDPOINT, json={"cmd": "sessions.destroy", "session": FLARE_SESSION}, ) - raise requests.RequestException(solution) + raise requests.RequestException(content["message"], response=response) session = FlareRequests()