Last active
January 15, 2019 16:40
-
-
Save bsodmike/a24a6c6b91f77d9bead1293dd6932c08 to your computer and use it in GitHub Desktop.
Python example to POST some JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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