分享知识,分享快乐

0%

python直接操作wordpress

111

python直接操作wordpress的模块:python-wordpress-xmlrpc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo

wp = Client('http://ask3.cn/xmlrpc.php', 'A3', 'AAaa11@@')
wp.call(GetPosts())


wp.call(GetUserInfo())


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))