From 068aebdaaf0117c871b39392397624fd7bad82f2 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Wed, 21 Dec 2022 16:46:50 +0000 Subject: [PATCH] Use custom Response on FlareRequest --- pynyaata/flarerequests.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pynyaata/flarerequests.py b/pynyaata/flarerequests.py index 7e70fa2..1920b97 100644 --- a/pynyaata/flarerequests.py +++ b/pynyaata/flarerequests.py @@ -1,5 +1,5 @@ from urllib import parse -from requests import RequestException, Session, post +from requests import RequestException, Response, Session, post from .config import CLOUDPROXY_ENDPOINT, REQUESTS_TIMEOUT @@ -35,13 +35,16 @@ class FlareRequests(Session): solution = response.json() if "solution" in solution: - response.status_code = solution["solution"]["status"] - response.headers = solution["solution"]["headers"] - response.raw = solution["solution"]["response"] - response.url = url - response.cookies = solution["solution"]["cookies"] + resolved = Response() - return response + resolved.raw = solution["solution"]["response"] + resolved.status_code = solution["solution"]["status"] + resolved.headers = solution["solution"]["headers"] + resolved.url = url + resolved.reason = solution["status"] + resolved.cookies = solution["solution"]["cookies"] + + return resolved raise RequestException(response) except RequestException: