当前位置: 首页>>代码示例>>Python>>正文


Python Api.write_video方法代码示例

本文整理汇总了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']
开发者ID:mdocode,项目名称:hangTumblr,代码行数:28,代码来源:tumblr-test.py

示例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()
开发者ID:jyr,项目名称:opentumblr-ce,代码行数:57,代码来源:video.py


注:本文中的tumblr.Api.write_video方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。