Answer the question
In order to leave comments, you need to log in
POST request in python. I can't figure out what's wrong?
import json
import requests
url = 'https://app.mango-office.ru/vpbx/stats/request'
vpbx_api_key = 'ключ'
sign = 'подпись'
mango_json = {
"date_from": "1072915200",
"date_to": "1072997812",
"fields": "records, start, finish, from_extension, from_number, to_extension, to_number, disconnect_reason", "call_party": {"extension": "116", "request_id": "001"}
}
data = {
'key': vpbx_api_key,
'sign': sign,
'json': json.dumps(mango_json),
}
req = requests.post(url, data=data)
print(req)
Answer the question
In order to leave comments, you need to log in
I didn’t look much, but try sending the converted json to requests right away. That is, you collect a dictionary, and then pass json=data in the request
url = 'https://app.mango-office.ru/vpbx/stats/request'
vpbx_api_key = 'ключ'
sign = 'подпись'
mango_json = {
"date_from": "1072915200",
"date_to": "1072997812",
"fields": "records, start, finish, from_extension, from_number, to_extension, to_number, disconnect_reason", "call_party": {"extension": "116", "request_id": "001"}
}
data = {
'key': vpbx_api_key,
'sign': sign,
'json': mango_json,
}
req = requests.post(url, json=data)
print(req)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question