Best method to check if user follows another


#1

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.


#2

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.


#3

Is there any way to higher the rate limits?


#4

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


#5

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.


#6

what you mean Tazeg?


#7

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


#8

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.


#9

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 : http://docs.tweepy.org/en/latest/api.html