用Python发博客

本文是用Python发的

(下面是后来手工改的)

用的是这个包 https://github.com/charlax/wordpresslib

需要手工安装

git clone https://github.com/charlax/wordpresslib.git
cd wordpresslib
python setup.py install

Python代码是

import wordpresslib

url = "http://yourblogurl.com/xmlrpc.php"
wp = wordpresslib.WordPressClient(url, 'user', 'pass')
wp.selectBlog(0)

post = wordpresslib.WordPressPost()
post.title = '用Python发博客'
post.description = '本文是用Python发的'
post.tags = ["wordpress", "lib", "python"]
idPost = wp.newPost(post, True)
print "posted as", idPost
read more