本文整理汇总了Python中tumblr.Api.write_quote方法的典型用法代码示例。如果您正苦于以下问题:Python Api.write_quote方法的具体用法?Python Api.write_quote怎么用?Python Api.write_quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Api
的用法示例。
在下文中一共展示了Api.write_quote方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWrite
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import write_quote [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: Quote
# 需要导入模块: from tumblr import Api [as 别名]
# 或者: from tumblr.Api import write_quote [as 别名]
class Quote(gui.CeFrame):
def __init__(self, api):
self.api = api
gui.CeFrame.__init__(self, title="Opentumblr CE")
self.l_quote = gui.Label(self, "Add a Quote", align = "center")
self.l_title = gui.Label(self, "Quote")
self.tc_title = gui.Edit(self, multiline = True)
self.l_source = gui.Label(self, "Source (optional)")
self.tc_source = 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.OnCreateQuote)
self.b_cancel.bind(clicked = self.OnCancel)
self.__set_properties()
self.__do_layout()
def __set_properties(self):
pass
def __do_layout(self):
s_quote = gui.VBox(border = (5,5,5,5), spacing = 5)
s_quote.add(self.l_quote)
s_quote.add(self.l_title)
s_quote.add(self.tc_title)
s_quote.add(self.l_source)
s_quote.add(self.tc_source)
s_quote.add(self.b_create)
s_quote.add(self.b_cancel)
self.sizer = s_quote
def OnCreateQuote(self, evt):
self.quote = self.tc_title.get_text()
self.source = self.tc_source.get_text()
if self.quote:
self.api = Api(self.api.name, self.api.email, self.api.password)
try:
self.post = self.api.write_quote(self.quote, self.source)
except:
print "Posteado en el primario"
self.close()
else:
gui.Message.ok(title = 'Warning', caption = 'Quote is required')
def OnCancel(self, evt):
self.close()
#if __name__ == '__main__':
# app = gui.Application(Quote())
# app.run()