本文整理汇总了Python中tumblr.Api.write_video方法的典型用法代码示例。如果您正苦于以下问题:Python Api.write_video方法的具体用法?Python Api.write_video怎么用?Python Api.write_video使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Api
的用法示例。
在下文中一共展示了Api.write_video方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWrite
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import write_video [as 别名]
def testWrite(self):
api = Api(BLOG, USER, PASSWORD)
newpost = api.write_regular('title','body')
post = api.read(newpost['id'])
assert newpost['id'] == post['id']
newpost = api.write_link('http://www.google.com')
post = api.read(newpost['id'])
assert newpost['id'] == post['id']
newpost = api.write_quote('it was the best of times...')
post = api.read(newpost['id'])
assert newpost['id'] == post['id']
newpost = api.write_conversation('me: wow\nyou: double wow!')
post = api.read(newpost['id'])
assert newpost['id'] == post['id']
newpost = api.write_video('http://www.youtube.com/watch?v=60og9gwKh1o')
post = api.read(newpost['id'])
assert newpost['id'] == post['id']
newpost = api.write_photo('http://www.google.com/intl/en_ALL/images/logo.gif')
post = api.read(newpost['id'])
assert newpost['id'] == post['id']
示例2: Video
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import write_video [as 别名]
class Video(gui.CeFrame):
def __init__(self, api):
self.api = api
gui.CeFrame.__init__(self, title="Opentumblr CE")
self.l_video = gui.Label(self, "Add a Video", align = "center")
self.l_embed = gui.Label(self, "Embed a Video")
self.tc_embed = gui.Edit(self)
self.l_caption = gui.Label(self, "Caption (optional)")
self.tc_caption = gui.Edit(self,multiline = True)
self.b_create = gui.Button(self, "Create Post")
self.b_cancel = gui.Button(self, "Cancel")
self.b_create.bind(clicked = self.OnCreateVideo)
self.b_cancel.bind(clicked = self.OnCancel)
self.__set_properties()
self.__do_layout()
def __set_properties(self):
pass
def __do_layout(self):
s_video = gui.VBox(border = (5,5,5,5), spacing = 2)
s_video.add(self.l_video)
s_video.add(self.l_embed)
s_video.add(self.tc_embed)
s_video.add(self.l_caption)
s_video.add(self.tc_caption)
s_video.add(self.b_create)
s_video.add(self.b_cancel)
self.sizer = s_video
def OnCreateVideo(self, evt):
self.embed = self.tc_embed.get_text()
self.caption = self.tc_caption.get_text()
if self.embed:
self.api = Api(self.api.name, self.api.email, self.api.password)
try:
self.post = self.api.write_video(self.embed, self.caption)
except:
print "Posteado en el primario"
self.close()
else:
gui.Message.ok(title = 'Warning', caption = 'Embed a video is required')
def OnCancel(self, evt):
self.close()
#if __name__ == '__main__':
# app = gui.Application(Video())
# app.run()