class MyStreamListener(tweepy.StreamListener):
def on_status(self, status):
print(status.text) # prints every tweet received
def on_error(self, status_code):
if status_code == 420: # end of monthly limit rate (500k)
return False
我使用Python 3.9,并通过pip安装了Tweepy。我在类行中遇到了AttributeError错误。 我的导入只是import tweepy。身份验证被正确处理。 在streaming.py文件中,我有Stream类。但是使用该类会以此结束。例如,即使存在on_status函数,也没有status.text。我有点困惑。