菜鸟笔记
提升您的技术认知

python在wordpress上发布文章-ag真人游戏

首先安装 python-wordpress-xmlrpc

pip3 install python-wordpress-xmlrpc

# -*- coding: utf-8 -*-
import json
from wordpress_xmlrpc import client, wordpresspost
from wordpress_xmlrpc.methods.posts import newpost
id = 'user'
password = 'pwd'
url = 'http://wordpress.url/xmlrpc.php'
wp = client(url, id, password)
post = wordpresspost()
post.post_status = 'publish'
post.title = '新的文章'
post.content = '这里是文章内容,不错噢'
post.excerpt = '这里是摘抄样式示例'
post.terms_names = {
"post_tag": ['python'],
"category": ['python']
}
wp.call(newpost(post))
网站地图