我正在尝试pythonwordpress的xmlrpc文档http://python-wordpress-xmlrpc.readthedocs.org/en/latest/overview.html中的行。在
以下是我所拥有的:
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'
问题是它只会在博客中添加草稿,而不会将其作为新帖子发布到博客中。在
它有什么问题,我如何纠正它?谢谢。在
根据official documentation,默认情况下帖子将作为草稿发送。在
在这里,您可以在将帖子发送到服务器之后修改wordpressspost对象的post_status属性。因此,它只在本地内存中发生了变化,服务器看不到变化。在
简单地说,把
在你打电话之前可湿性粉剂呼叫(NewPost(post))将使其按您想要的方式工作。在
相关问题 更多 >
编程相关推荐