Package: wordpress_json
Super thin Python wrapper for theWordpress REST API V2developed byStylight. Supports the documented read and write endpoints. Extensions and pull requests are encouraged and welcome.Limitations:doesn’t check input parametersreturns a single dictionary or a list of dictionaries, depending on the API endpointonly supports basic auth, and it currently cannot be used without authenticationDependencies:requestssixInstallationpip install wordpress-jsonBefore being able to use this package make sure you configure Wordpress properly.Wordpress configurationYou need to install the WP-API Plugin. To do so:Go to your Wordpress DashboardClick on Plugins in the left sidebarSearch for “REST API”. Install the plugin named “WordPress REST API (Version 2)”, by clicking on the “Install” button.Activate the plugin on the next screen.You need to install and activate the WP REST API Meta Endpoints plugin for the WP-API :Click on Plugins in the left sidebarClick on “Add New” on the top right, next to “Plugin”Search for “WP REST API Meta Endpoints”. Install the plugin named “WP REST API Meta Endpoints”, by clicking on the  “Install” button.Activate the plugin on the next screen.You need to install and activate the Basic-Auth plugin for the WP-API :downloadhttps://github.com/WP-API/Basic-Auth/archive/master.zipOpen your Wordpress Admin DashboardClick on Plugins in the left sidebarClick on “Add New” on the top right, next to “Plugin”Click on “Upload Plugin”, Choose File, and select the file you downloaded at step 1 (master.zip)Click on Install NowActivate the plugin on the next screen.Change permalink configuration to ‘Post name’ in Permalink Settings.Usage>>>wp=WordpressJsonWrapper('http://example.com/wp-json/wp/v2','wp_user','wp_password')>>>posts=wp.get_posts()>>>posts[0].keys()dict_keys(['format','featured_media','author',...])>>>posts[0].get('title'){'rendered':'Tweetle Beetles'}>>>posts[0].get('content'){'rendered':'<p>What do you know about tweetle beetles? ...'}>>>posts[0].get('id')42>>>wp.create_meta(post_id=42,data=dict(key='genre',value='fanciful'))>>>meta=wp.get_meta(post_id=42)>>>meta[0].get('key')'genre'>>>meta[0].get('value')'fanciful'Release History0.3.1 (2017-02-22)DocumentationFix changelog0.3.0 (2017-02-22)New FeaturesSupport non-JSON data in requestsBehavioural ChangesUse POST instead of PUT for update requests. This may not work with Wordpress
versions below 4.7.Raise an error if the Content-Type on response is not JSON.0.2.4 (2016-08-17)MiscellaneousRemove debug code0.2.3 (2016-08-17)BugfixesFix error handlingDocumentationUpdate example usage with correct namespace for v20.2.2 (2016-07-22)Improvementssix and requests libraries not pinned to versions0.2.1 (2016-07-20)BugfixesFix syntax errors in README.rstAdd missing dependencysixto setup.pyMiscellaneousUpdate authors0.2.0 (2016-07-20)ImprovementsUpdate for v2 WP-API0.1.5 (2015-07-16)BugfixesInclude HISTORY.rst in setup.py0.1.4 (2015-07-16)DocumentationFix syntax errors in README.rst and HISTORY.rst0.1.3 (2015-07-16)ImprovementsAllow raw url parameters to be passed in and used for the API calls0.1.2 (2015-02-03)ImprovementsAllow headers to be passed in and used for the API callsDocumentationAdd HISTORY.rst (this change log)0.1.1 (2015-01-27)BugfixesUse json parameter instead of data parameter for requests0.1.0 (2015-01-27)Birth!