我将尝试使用Python来向Tumblr上发布图片,具体来说是使用http://code.google.com/p/python-tumblr/。
当我运行这个程序时,结果是博客被访问,但是输出的内容如下所示:
#!/usr/bin/python
from tumblr import Api
import sys
BLOG='example.tumblr.com'
USER='example@example.com'
PASSWORD='example'
api = Api(BLOG,USER,PASSWORD)
post_data = "picture.png"
title = "Title of my entry"
body = "this is a story with a picture"
api.write_regular(title, body + post_data)
当我运行这个程序时,结果是博客被访问,但是输出的内容如下所示:
而实际上输出的内容是这样的:我的文章标题
这是一个带有图片的故事
[img]
我的文章标题
这是一个带有图片的故事 picture.png