small fixes
This commit is contained in:
@@ -107,6 +107,8 @@ function buildPythonScript() {
|
||||
payload.app_variant = $("pyAppVariant").value;
|
||||
}
|
||||
|
||||
const payloadJson = JSON.stringify(payload, null, 4);
|
||||
|
||||
const script = `#!/usr/bin/env python3
|
||||
import json
|
||||
import re
|
||||
@@ -115,7 +117,8 @@ import requests
|
||||
BASE_URL = ${JSON.stringify(baseUrl)}
|
||||
ENDPOINT = ${JSON.stringify(endpoint)}
|
||||
|
||||
payload = ${JSON.stringify(payload, null, 4)}
|
||||
payload_json = """${payloadJson}"""
|
||||
payload = json.loads(payload_json)
|
||||
|
||||
resp = requests.post(BASE_URL + ENDPOINT, json=payload, timeout=120)
|
||||
|
||||
@@ -127,7 +130,6 @@ print("X-Generated-At:", resp.headers.get("X-Generated-At"))
|
||||
ct = (resp.headers.get("Content-Type") or "").lower()
|
||||
|
||||
if resp.status_code >= 400:
|
||||
# try show JSON error, else text
|
||||
try:
|
||||
print(json.dumps(resp.json(), indent=2))
|
||||
except Exception:
|
||||
@@ -143,7 +145,6 @@ else:
|
||||
if m:
|
||||
filename = m.group(1)
|
||||
else:
|
||||
# fallback extension
|
||||
if "text/csv" in ct:
|
||||
filename += ".csv"
|
||||
elif "javascript" in ct:
|
||||
|
||||
Reference in New Issue
Block a user