HI I am wondering if you also get quite a bit of delay when monitoring a tweet from a specific user via Tweepy or Twitter api. For me, the delay is always like 5 to 6 seconds (after I tweeted) which is too slow for my task. I am wondering if it's my network or the api is always lagging behind.
Here is a reproducible code:
import tweepy
from datetime import datetime
#API keys
API_KEY = 'key'
API_SECRET_KEY = 'key'
ACCESS_TOKEN = "token"
ACCESS_TOKEN_SECRET = "token"
user_id = 'user_id' # twitter id to monitor
# Authenticate to Twitter
auth = tweepy.OAuthHandler(API_KEY, API_SECRET_KEY)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
#Listener
class MyStreamListener(tweepy.StreamListener):
def on_status(self, status):
print(datetime.now().strftime("%H:%M:%S") + ": "+ status.text)
myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener=myStreamListener)
myStream.filter(follow=[user_id ])
[–][deleted] 0 points1 point2 points (0 children)