B
B
Borodat Inzhenerovich2015-12-06 10:11:35
Python
Borodat Inzhenerovich, 2015-12-06 10:11:35

yandex.locator API "Specify xml or json param" error, how to fix?

I'm trying to generate a request in accordance with https://tech.yandex.ru/locator/doc/dg/api/capture-... in python using the requests docs.python-requests.org/en/latest/ module. I tried everything, I always get an error: Specify xml or json param.
Has anyone experienced something similar? What could be the problem?
Errors in syntax and application of the requests module are excluded.
Code:
73ea76705f5a4ca497a63e88c7d554b7.png
Error:
4d6e9b11284741249e435de31f76935d.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2015-12-06
@o3diev

It says "Specify xml or json param"
Add the response data format to the request.

K
kur, 2017-04-11
@kur

Also scratched my head. It turns out everything is very simple.

requests.post(url=url, headers=headers, data="json=" + data)

B
Borodat Inzhenerovich, 2015-12-06
@o3diev

Roman Kitaev I'm trying, I specify the format in the headers. Here is the code:
here is the message:
fe7460f6ed53482983e697ba8bf82b40.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question