本文整理汇总了Python中tumblr.Tumblr.setAttachment方法的典型用法代码示例。如果您正苦于以下问题:Python Tumblr.setAttachment方法的具体用法?Python Tumblr.setAttachment怎么用?Python Tumblr.setAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Tumblr
的用法示例。
在下文中一共展示了Tumblr.setAttachment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import setAttachment [as 别名]
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)
b.setAttachment('/home/marcelo/file.jpg')
if b.postEntry():
print "Article posted!"
else:
print "Article NOT posted!"
b.clear()
b.setTitle('标题')
b.setContent('内容')
if b.postEntry():
print "Article posted!"
else:
print "Article NOT posted!"