本文整理汇总了Python中timeline.Timeline.start_stream方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.start_stream方法的具体用法?Python Timeline.start_stream怎么用?Python Timeline.start_stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timeline.Timeline
的用法示例。
在下文中一共展示了Timeline.start_stream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_timeline
# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import start_stream [as 别名]
def new_timeline(self, label, method, userstream = False, *args, **kwargs):
# Create Timeline Object
tl = Timeline()
if method == "filter":
if self.get_filter_tab():
# filter method only one connection
self.message_dialog(
"May create only one standing connection to the Streaming API.\n"
"Please close existing Streaming API tab if you want.")
tl.destroy()
return
# set Streaming API stream
tl.set_stream("filter", kwargs)
else:
interval = self.get_default_interval(method)
tl.set_timeline(method, interval, self.scounts, args, kwargs)
# Put error to statubar
tl.timeline.on_twitterapi_error = self.on_twitterapi_error
# for Event
tl.view.new_timeline = self.new_timeline
# Add Notebook (Tab view)
uid = self.new_tab(tl, label, tl, kwargs.get("deny_close", False))
if method == "filter": self.set_filter_tab(uid)
# Set color
tl.view.set_color(self.status_color)
if method == "mentions":
# memory mentions tab_id
self.timeline_mention = uid
tl.on_status_added = self.on_mentions_added
else:
tl.on_status_added = self.on_status_added
# Put tweet information to statusbar
tl.view.on_status_selection_changed = self.on_status_selection_changed
# Reply on double click
tl.view.on_status_activated = self.on_status_activated
# Set UserStream parameter
if userstream:
tl.set_stream("user")
tl.start_stream()
tl.start_timeline()