【发布时间】:2022-10-16 21:47:48
【问题描述】:
我正在尝试在来自特定推特帐户的推文中收听某个角色。
我得到一个编译时错误。
这是代码的相关部分:
import tweepy
class MyStreamListener(tweepy.streaming.StreamListener):
def on_status(self, status):
print(status.text)
def main():
api = twitter_authentication() #this function does the necessary twitter auth
myStreamListener = MyStreamListener()
myStream = tweepy.streaming.Stream(auth=api.auth, listener=myStreamListener)
myStream.filter(track=["test"], follow=["123456"])
当我在 pycharm 中运行它时,我收到以下错误:
line 68, in <module>
class MyStreamListener(tweepy.streaming.StreamListener):
AttributeError: module 'tweepy.streaming' has no attribute 'StreamListener'
【问题讨论】: