Fix encoding
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2023-01-05 21:05:41 +01:00
parent e1e805a91b
commit 954b019ef2

View File

@ -39,6 +39,7 @@ class FlareRequests(requests.Session):
content = response.json() content = response.json()
if "solution" in content: if "solution" in content:
encoding = None
solution = content["solution"] solution = content["solution"]
if "content-type" in solution["headers"]: if "content-type" in solution["headers"]:
content_type = solution["headers"]["content-type"].split(";") content_type = solution["headers"]["content-type"].split(";")
@ -53,7 +54,7 @@ class FlareRequests(requests.Session):
resolved.headers = solution["headers"] resolved.headers = solution["headers"]
resolved.raw = io.BytesIO(solution["response"].encode()) resolved.raw = io.BytesIO(solution["response"].encode())
resolved.url = url resolved.url = url
resolved.encoding = encoding or None resolved.encoding = encoding
resolved.reason = content["status"] resolved.reason = content["status"]
resolved.cookies = solution["cookies"] resolved.cookies = solution["cookies"]