Skip to content

Instantly share code, notes, and snippets.

@fellipeh
Created January 4, 2016 19:27
Show Gist options
  • Save fellipeh/fdcf82edb712f4ce6efe to your computer and use it in GitHub Desktop.
Save fellipeh/fdcf82edb712f4ce6efe to your computer and use it in GitHub Desktop.
import json
import requests
data = {
"description": "ALTO ALEGRE DOS PARECIS",
}
url = "http://localhost:8000/api/resource/ToDo"
res = requests.post(url= url, data='data'+json.dumps(data), headers={'Content-type': 'application/json'})
@MaxMorais
Copy link

@fellipeh

use:

requests.post(url=url, data={'data': json.dumps(data)}, headers={'Content-type': 'application/json'})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment