Skip to content

Instantly share code, notes, and snippets.

@bsodmike
Last active January 15, 2019 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsodmike/a24a6c6b91f77d9bead1293dd6932c08 to your computer and use it in GitHub Desktop.
Save bsodmike/a24a6c6b91f77d9bead1293dd6932c08 to your computer and use it in GitHub Desktop.
Python example to POST some JSON
import requests
import json
url = 'http://localhost:2368/ghost/api/v0.1/posts'
payload = {
"posts": [{ "markdown": "<p>Some content goes here</p>", "title": "New", "status": "published"}]
}
headers = {
"Authorization": "Bearer 7CVoMaf68zd6jeWo9oz4syKvTyizrdDf5Uyv7vEAJHHwU8ceKoRcXw4tLw0V6m4z7MI3uXc4aI8iPFkPaTRGWXrKt4myAMJsK5YgWdDy8N26MqwNNxq2XC0bKOooU1hgyCJpfNecnBztRyXkFZUZUqbRFbkt4kBBYDhD6O7hJ7qzpSwjeX4E0JEvEU3R4ye"
}
r = requests.post(url, json=payload, headers=headers)
print(r.content)
print(r.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment