Closed walidbousseta closed 3 years ago
I'm getting a bad request message status_code 400, here's my code
BASEURL = "https://api.feedbin.com/v2/" USEAREMAIL = "xxxxxx" PASSWORD = "xxxxx" s = requests.Session() s.auth = (USEAREMAIL, PASSWORD) r = s.get(BASEURL+'unread_entries.json').json() data = {"unread_entries":list(ids)} # {'unread_entries': [3295912461, 3294459305, 3293974343, 3293133656]} headers = {'Content-Type': 'application/json'} rp = s.delete(BASEURL+'unread_entries.json', headers=headers, data=data) rp.status_code # 400
the solution that worked was rp = s.delete(BASEURL+'unread_entries.json', headers=headers, data=json.dumps(data)) adding the json parsing got it to work json.dumps(data)
rp = s.delete(BASEURL+'unread_entries.json', headers=headers, data=json.dumps(data))
json.dumps(data)
I'm getting a bad request message status_code 400, here's my code