Skip to content

Instantly share code, notes, and snippets.

Created March 4, 2016 14:57
Show Gist options
  • Select an option

  • Save anonymous/da2892c64eec2d02fe64 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/da2892c64eec2d02fe64 to your computer and use it in GitHub Desktop.
from wordpress_json import WordpressJsonWrapper
import json
# construct a wrapper
wp = WordpressJsonWrapper("http://example.com/wp-json", "wp_user", "wp_password")
# optional headers
headers = {
"User-Agent": "curl",
"Content-Type": "text/json",
# ...
}
# make requests, e.g. list posts
print "----------- list posts -------------"
posts = wp.get_posts()
print json.dumps(posts);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment