Answer the question
In order to leave comments, you need to log in
When sending a POST request to the service with json, a 400 Bad request error. What is the reason?
Friends, a complete noob in python ...
There is a service that answers any question buy an elephant. I know for sure that the service code works, because checked - published in Azure and accessed it from one of the Yandex services - received the necessary "buy an elephant".
Next, I'm trying to set up an environment for development and debugging on a local computer.
I launched the service on the local, took from the text of the request sent by Yandex and try to send the following request to the local service:
curl -H "Content-type: application/json" -X POST -d '{"meta":{"client_id":"Developer Console","locale":"ru-RU","timezone":"UTC"},"request":{"command":"hello","original_utterance":"hello","type":"SimpleUtterance"},"session":{"message_id":0,"new":true,"session_id":"d2c43ba8-79c40ec3-e43658a8-1ae64","skill_id":"c9ff791f-8aaa-46e4-ad9d-f4ef7b56a157","user_id":"05C1AFD72D35A17289B245FF28308A0F1995F0C00C73FB2A568EA420DFB927B6"},"version":"1.0"}' localhost:5000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>
response = {
"version": request.json['version'],
"session": request.json['session'],
"response": {
"end_session": False
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question