Reputation: 20856
Im trying to post data to my Django server but when I check the server the Querydict is empty. When I call from the browser it does look good.
import requests
import json
headers = {
"AUTHORIZATION": "1234",
"Content-type": "application/json",
"Accept": "text/plain"
}
print headers
payload = {
"start_date_s":"04/01/2016",
"start_date_e":"04/15/2016"
}
r = requests.post('http://localhost:8000/get-ticket-data',headers=headers, json = json.dumps(payload))
print r.content
print r.text
Upvotes: 1
Views: 1132
Reputation: 5600
if you send json request, you need to use request.body
in django view to get the that, not request.POST
Upvotes: 0