示例#1
0
#coding=utf-8

'''Demo program which uses the live-journal module.'''

import sys
from tumblr import Tumblr

#username='******', password='******'
b = Tumblr('http://peter4test.tumblr.com/', None, '*****@*****.**', 'peter2win')

if not b.isItMe():
    print 'isItMe() False: invalid url'
    sys.exit()

if not b.authenticate():
    print "Authentication failed"
    sys.exit()

print "My available tags:"
for tag in b.getTags():
    print tag

print "My available categories:"
for cat in b.getCategories():
    print cat

b.setTitle('draft title')
b.setContent('draft content')

# technology exists and was retrieved through getCategories, but
# business doesn't exist so behind the scenes it must be added to