N
N
Nodir Malikov2021-01-25 16:21:42
Python
Nodir Malikov, 2021-01-25 16:21:42

Where is the error when accessing the Yandex Taxi API?

I am making a request to display drivers using this example , but in python

, when requested, it returns an error 400 and
{'message': 'sort_order must be an array'}

# Yandex.Taxi API
URL_AUTH = 'https://fleet-api.taxi.yandex.net/v1/parks/driver-profiles/list'

headers = {
    'X-Client-ID': config.CLIENT_ID,
    'X-API-Key': config.API_KEY,
}

data = '{ "limit": 10, "offset": 0, "query": { "park": { "id": "9e34e3e8188542f693xxxxxxxxxx" } }, "sort_order": ' \
       '{ "direction": "asc", "field": "driver_profile.created_date" } } '
response = requests.post(URL_AUTH, headers=headers, data=data)
print(response.status_code)
print(response.json())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-01-25
@SoreMix

Pass just as json

data = { "limit": 10, "offset": 0, "query": { "park": { "id": "9e34e3e8188542f693xxxxxxxxxx" } }, "sort_order":{ "direction": "asc", "field": "driver_profile.created_date" } }
response = requests.post(URL_AUTH, headers=headers, json=data)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question