Press ESC to close

使用python wordpress xmlprc 提交betterdocs 文章

使用python wordpress xmlprc 提交betterdocs 文章

from http import client
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc import WordPressTerm
from wordpress_xmlrpc.methods import taxonomies

wp = Client('https://www.xacisco.net/blog/xmlrpc.php', 'xxx', 'xxx')

# now let's create a new product
widget = WordPressPost()
widget.post_type = 'docs'
widget.title = 'Widgetlast02'
widget.content = 'This is the widgets description.'
widget.post_status = 'publish'
doc_category = wp.call(taxonomies.GetTerm('doc_category', 871))
widget.terms.append(doc_category)
kb_category = wp.call(taxonomies.GetTerm('knowledge_base', 872))
widget.terms.append(kb_category)
widget.id = wp.call(posts.NewPost(widget))

发表回复