本文整理汇总了Python中tumblr.Tumblr.getCategories方法的典型用法代码示例。如果您正苦于以下问题:Python Tumblr.getCategories方法的具体用法?Python Tumblr.getCategories怎么用?Python Tumblr.getCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Tumblr
的用法示例。
在下文中一共展示了Tumblr.getCategories方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tumblr
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import getCategories [as 别名]
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
# the system and linked with this post somehow
catList = ['technology', 'business']
b.setCategories(catList)
# The same might happen here if a tag is new
tagsList = ['技术', '商业']
b.setTags(tagsList)