I'm writing som simple request and just can't understant what's wrong
data1 = df.loc[N, 'online_raw_json']
print(type(data1))
print(data1)
data1 = json.dumps(data1)
print(type(data1))
print(data1)
response = requests.post("http://127.0.0.1:5000/predict", json=data1)
print(response.text)
OUTPUT:
<class 'str'>
{"batch_id": 230866, "heat_no": "2019333", "tasks":7, "oxy": 41.6, ... "data": []}]}
<class 'str'>
"{\"batch_id\": 230866, \"heat_no\": \"2019333\", \"tasks\": 7, ... \"data\": []}]}"
So I get error Exception happened in API function: the JSON object must be str, bytes or bytearray, not list
json.dumps must provide "proper" json, but still it is treated like a string.