O
O
Oleg2021-09-29 16:11:16
Python
Oleg, 2021-09-29 16:11:16

API Yandex. How to overcome the error with passing the date in the request?

I'm trying to get data using the Yandex API (), but an error is returned - "{"code":"400","message":"Parse error at pos 109, path 'query.park.order.booked_at.from': Can't parse datetime: 2021-09-01, the latest token was :\"2021-09-01\""}"

Please tell me what am I doing wrong? I can't decide on my own.

import requests
import json

url = 'https://fleet-api.taxi.yandex.net/v1/parks/orders/list'

data = {
    "limit": 1,
    "query": {
        "park": {
            "id": Park_ID,

            "order": {
                "booked_at": {
                    "from": "2021-09-01",
                    "to": "T18:25+03:00",
                },
            },
        },
    },
}
headers= {
        "X-Client-ID": Client_ID,
        "X-API-Key": API_KEY,
        "Accept-Language": "ru"
    }

data =json.dumps(data)
r = requests.post(url,data=data, headers=headers )
print(r.text)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-09-29
@Oleg_F

RTFM

query.park.order.booked_at.from *
- ISO 8601 string with timezone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question