This commit is contained in:
parent
496352a7ef
commit
335abfb6f6
@ -14,9 +14,9 @@ CLOUDPROXY_ENDPOINT = os.getenv("CLOUDPROXY_ENDPOINT")
|
|||||||
|
|
||||||
|
|
||||||
class FlareRequests(requests.Session):
|
class FlareRequests(requests.Session):
|
||||||
def request(self, method, url, params=None, **kwargs):
|
def request(self, method, url, params=None, data=None, **kwargs):
|
||||||
if not CLOUDPROXY_ENDPOINT:
|
if not CLOUDPROXY_ENDPOINT:
|
||||||
return super().request(method, url, params, **kwargs)
|
return super().request(method, url, params, data, **kwargs)
|
||||||
|
|
||||||
sessions = requests.post(
|
sessions = requests.post(
|
||||||
CLOUDPROXY_ENDPOINT, json={"cmd": "sessions.list"}
|
CLOUDPROXY_ENDPOINT, json={"cmd": "sessions.list"}
|
||||||
@ -35,14 +35,16 @@ class FlareRequests(requests.Session):
|
|||||||
else:
|
else:
|
||||||
raise requests.RequestException(response)
|
raise requests.RequestException(response)
|
||||||
|
|
||||||
|
url += "&" if len(url.split("?")) > 1 else "?"
|
||||||
|
|
||||||
post_data = {
|
post_data = {
|
||||||
"cmd": f"request.{method.lower()}",
|
"cmd": f"request.{method.lower()}",
|
||||||
"session": FLARESESSION,
|
"session": FLARESESSION,
|
||||||
"url": url,
|
"url": f"{url}{urllib.parse.urlencode(params)}",
|
||||||
}
|
}
|
||||||
|
|
||||||
if params:
|
if data:
|
||||||
post_data["postData"] = urllib.parse.urlencode(params)
|
post_data["postData"] = urllib.parse.urlencode(data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
|
Loading…
Reference in New Issue
Block a user