I want to post articles to WordPress. I try this:
from wordpress import API
import json
wpapi = API(
url="http://my_domain",
consumer_key="xxx",
consumer_secret="xxx",
api="wp-json",
version="wp/v2",
wp_user="admin",
wp_pass="adminpass"
)
data = {
"content": "This is the big mess I've made in python",
"status": "publish",
"title": "Stuff from python",
"slug": "here-is-another-api-post",
"author": "1"
}
wpapi.post('posts', data)
An error says:
UserWarning: <exception str() failed>
What should I do?