Unable to stop Streaming in tweepy after one minute

后端 未结 3 596
逝去的感伤
逝去的感伤 2021-02-03 12:26

I am trying to stream twitter data for a period of time of say 5 minutes, using the Stream.filter() method. I am storing the retrieved tweets in a JSON file. The problem is I am

3条回答
  •  半阙折子戏
    2021-02-03 12:31

    Access the variable myListener.running but instead of passing MyListener directly to Stream create a variable as follows:

    myListener = MyListener()
    timeout code here... suchas time.sleep(20)
    myListener.running = False 
    

提交回复
热议问题