python自动发布网站文章 wordpress wordpress_xmlrpc

 使用了wordpress_xmlrpc包,使用前先再wordpress站点安装插件

官方文档 :https://python-wordpress-xmlrpc.readthedocs.io/en/latest/ref/wordpress.html


#coding=utf-8
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo


wp = Client('http://www.lianhanghao.xyz/xmlrpc.php', '****', '*****')


post = WordPressPost()
post.title = '你好'
post.content = '很高兴见到你'
post.post_status = 'publish'
post.terms_names = {
   'post_tag': ['test', 'firstpost'],
  'category': ['Introductions', 'Tests']
}
wp.call(NewPost(post))

我的示范网站:

http://www.lianhanghao.xyz

你可能感兴趣的:(python,建站)