I am trying to create a Django webapp that uses the Twitter Streaming API via the tweepy.Stream () function. I have a difficult time comprehending the correct implementation.
The simplest functionality that I would like to have is to count the number of tweets containing the hashtag in real time. Therefore, I would open the stream, filtering by keywords, every time a new tweet comes through the connection, I increase the counter. This counter is then displayed on the web page and updated using AJAX or otherwise.
The problem is that the tweepy.Stream () function must constantly work and connect to twitter (this is the point). How can I run this thread against the background of a Django application, increasing the counters that can be displayed in (near) real time?
Thanks in advance!
source
share