From 0deb6b4284ca039ee5dba775a54b544a7cb6df1f Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Wed, 21 Dec 2022 17:20:16 +0000 Subject: [PATCH] Fix postData on GET --- pynyaata/flarerequests.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pynyaata/flarerequests.py b/pynyaata/flarerequests.py index 93a21e0..1677799 100644 --- a/pynyaata/flarerequests.py +++ b/pynyaata/flarerequests.py @@ -8,15 +8,20 @@ class FlareRequests(Session): if not CLOUDPROXY_ENDPOINT: return super().request(method, url, params, timeout=timeout, **kwargs) + post_data = { + "cmd": f"request.{method.lower()}", + "url": url, + "maxTimeout": timeout * 1000, + } + + if params: + post_data["postData"] = parse.urlencode(params) + response = post( CLOUDPROXY_ENDPOINT, - json={ - "cmd": f"request.{method.lower()}", - "url": url, - "postData": parse.urlencode(params) if params else "", - "maxTimeout": timeout * 1000, - }, + json=post_data, ) + solution = response.json() if "solution" in solution: