I want to create a task in python's wunderlist api, and this is my code:
import requests, json
access_token = "MY TOKEN"
client_id= "My Client ID"
h = {"X-Access-Token": access_token, "X-Client-ID": client_id, "Content-Type": "application/json"
da = {"list_ld": 330478059, "title": "TEST TASK"}
url= "https://a.wunderlist.com/api/v1/tasks"
r= requests.post(url, headers=h, data=da)
But I get "bad_request", why?
The data in
da
that you send needs to be JSONified. Try dumping it to a string -Alternatively, pass
da
directly as an argument tojson=...
, which'd automatically take care of serialisation -