Unable to stop Streaming in tweepy after one minute

后端 未结 3 539
逝去的感伤
逝去的感伤 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:35

    So, I was having this issue as well. Fortunately Tweepy is open source so it's easy so dig into the problem.

    Basically the important part is this here:

    def _data(self, data):
        if self.listener.on_data(data) is False:
            self.running = False
    

    On Stream class in streaming.py

    That means, to close the connection you just have to return false on the listener's on_data() method.

提交回复
热议问题