Answer the question
In order to leave comments, you need to log in
Problem when sending a POST request in python?
Hello! I'm trying to send a post request.
Here is the post request:
POST /token HTTP/1.1
Host: oauth.yandex.ru
Content-type: application/x-www-form-urlencoded
Content-Length: <request body length>
[Authorization: Basic <encoded string client_id:client_secret>]
grant_type=authorization_code
& code=<verification code>
[& client_id=<app id>]
[& client_secret=<app password>]
[& device_id=<device id>]
[& device_name=<device name>]
payload = ({"grant_type":"authorization_code","code" : message.text, "client_id":const.idApps_Yand,"client_secret":const.passApp_yand,"device_id": const.UUID, "device_name":const.divace_name})
headers = {"Host": "oauth.yandex.ru","Content-type": "application/x-www-form-urlencoded", "Content-Length":"2"}
r = requests.post(url=URL,data=payload,headers=headers)
Answer the question
In order to leave comments, you need to log in
Python IMHO has nothing to do with it. The message clearly contains an indication of the error
"Bad Request: message is too long" - Too large request in the POST message
Increase the size of accepted POST messages on the server side.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question