Reputation: 9338
I am trying the lines in Python wordpress_xmlrpc documentation, http://python-wordpress-xmlrpc.readthedocs.org/en/latest/overview.html.
Here is what I have:
wp = Client('https://remembertochange.wordpress.com/xmlrpc.php', 'user', 'pass')
posts = wp.call(GetPosts())
post = WordPressPost()
post.title = 'My new title'
post.content = 'This is the body of my new post.'
post.terms_names = {
'post_tag': ['test', 'firstpost'],
'category': ['Introductions', 'Tests']
}
wp.call(NewPost(post))
post.post_status = 'publish'
The problem is it only adds a draft to the blog, and doesn’t publish it as a new post to the blog.
What’s wrong with it, and how can I correct it? Thanks.
Upvotes: 1
Views: 255
Reputation: 1067
According to official documentation, posts will be sent as drafts by default.
Here, you modify the post_status property of WordPressPost object after you sent that post to the server. Thus, it's only changed in local memory and server does not see the change.
Simply, putting
post.post_status = 'publish'
before you make the call wp.call(NewPost(post)) will make it work as the way you want.
Upvotes: 1