首页 > 流水帐 > 用Python发博客

用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
Advertisements
分类:流水帐 标签:, ,
  1. 还没有评论。
  1. No trackbacks yet.

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: