本文整理汇总了Python中twitter.Twitter.set_retry_prompt方法的典型用法代码示例。如果您正苦于以下问题:Python Twitter.set_retry_prompt方法的具体用法?Python Twitter.set_retry_prompt怎么用?Python Twitter.set_retry_prompt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.Twitter
的用法示例。
在下文中一共展示了Twitter.set_retry_prompt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TwitterApp
# 需要导入模块: from twitter import Twitter [as 别名]
# 或者: from twitter.Twitter import set_retry_prompt [as 别名]
class TwitterApp(App):
def __init__(self, *args, **kwargs):
global app
app = self
global modal_ctl
modal_ctl = ModalCtl()
super(TwitterApp, self).__init__(*args, **kwargs)
def on_start(self):
netcheck.set_prompt(self.ask_connect)
creds = {'consumer_key' : '4N5RNkH9Zkm3qtxbYbi6Fg',
'consumer_secret' : 'YjyTa1hHExzWSVQqkuR4JAK2yFPrgD3dDl6sjulg'}
self.twitter = Twitter(creds)
self.twitter.set_retry_prompt(self.ask_retry_tweet)
def on_pause(self):
return True
def on_resume(self):
pass
def build(self):
self.ttext = TextInput(text='Kivy will set you free!',
size_hint=(1.0, 0.3),
font_size=18)
tb = TweetButton(text='Tweet Text',
size_hint=(0.5, 0.2))
tib = TweetImageButton(text='Tweet Photo',
size_hint=(0.5, 0.2))
root = StackLayout()
root.add_widget(self.ttext)
root.add_widget(tb)
root.add_widget(tib)
return root
def ask_connect(self, tried_connect_callback):
Logger.info('Opening net connect prompt')
text = ('You need internet access to do that. Do you '
'want to go to settings to try connecting?')
content = AskUser(text=text,
action_name='Settings',
callback=tried_connect_callback,
auto_dismiss=False)
p = Popup(title = 'Network Unavailable',
content = content,
size_hint=(0.8, 0.4),
pos_hint={'x':0.1, 'y': 0.35})
modal_ctl.modal = p
p.open()
def ask_retry_tweet(self, retry_twitter_callback):
Logger.info('Tweet Failed')
text = ('There was a problem sending the tweet. Would'
' you like to retry?')
content = AskUser(text=text,
action_name='Retry',
callback=retry_twitter_callback,
auto_dismiss=False)
p = Popup(title = 'Tweet Failed',
content = content,
size_hint=(0.8, 0.4),
pos_hint={'x':0.1, 'y': 0.35})
modal_ctl.modal = p
p.open()