Best method to check if user follows another


Hi there. I am new with twitter API and i would like to know what is the best option to check if user is following another. I am using look friendship but i have a lot of users and i always reach rate limit. Can you help me thanks.


Well, that’s the most efficient way. The only other way I could think of would be to use the friends/ids endpoint but if they have more than 5,000 that could exhaust your limits pretty quickly too.


Is there any way to higher the rate limits?


No, there is no way to get a different rate limit on those endpoints. What exactly is your use case?


Requesting “friendships/show” is limited to 180 within a 15 mn window, i.e. you can send 1 request every 5 seconds. So, you should add a “sleep(5)” in your code, between each request.


what you mean Tazeg?


I got limit rate after some seconds. My requests are more or less 1 each 5 seconds-


I want to check if user is following another. But i always get rate limit error after some time :frowning: i have a lot of users.


That’s what i meant : You have to send a request each 5 seconds.

If you are using Tweepy in Python, you can add the flag “wait_on_rate_limit=True” so that when you are over limit, Tweepy is waiting automaticaly before to send a new request. cf :