Account suspended even though rate-limit was not exceeded

account-access

#1

Hi,

I am trying to build a twitter App with python. I am trying to access user data with the API using the URL

TWITTER_URL = 'https://api.twitter.com/1.1/users/show.json'

The rate limit is 180 per 15min. To comply with the rate-limit I built a loop

while True:
    if(remaining>0):
        ## Code for accessing Twitter 
        headers = connection.info().dict
        print 'Remaining', headers['x-rate-limit-remaining']
        remaining=int(headers['x-rate-limit-remaining'])

        ##Code for saving the information

    else:
        print "waiting for 15min since " + datetime.datetime.now()
        time.sleep(900) # delays for 900 seconds = 15min
        remaining=10

I can see that my rate-limit is not exceeded because int(headers['x-rate-limit-remaining']) is larger than 1. However my program aborts and my account is suspended even though I have only been downloading very little information. {"errors": [{"message": "User has been suspended.", "code": 63}]}
Is there a reason behind this?

Best


#2

My only guess is that the time to wait is not exactly 15 minutes but rather a little bit longer. But to be honest this is a very vague guess.


#3

Hi Yeikel,

thanks for your reply. The program already stopped when I ran the first loop. I could see that my rate limit was about 100 (so I had looked into 80 accounts) so the program had not hit any rate-limit…

Is there an “additional rate limit” to the 180 posts/15min?


#4

Does this relate to the account under which you were running your app, or is it an error from the users/show.json endpoint relating to the account you were querying?


#5

Hi Andy,

great! I tried to read a different account and it worked, i.e. the account I wanted to look into was suspended. Then I caught the error with try+except. Many thanks!!