本文整理汇总了Python中tumblr.Tumblr.authenticate方法的典型用法代码示例。如果您正苦于以下问题:Python Tumblr.authenticate方法的具体用法?Python Tumblr.authenticate怎么用?Python Tumblr.authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Tumblr
的用法示例。
在下文中一共展示了Tumblr.authenticate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tumblr
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import authenticate [as 别名]
#coding=utf-8
'''Demo program which uses the live-journal module.'''
import sys
from tumblr import Tumblr
#username='peter4test', password='peter2win'
b = Tumblr('http://peter4test.tumblr.com/', None, '[email protected]', '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