Skip to content Skip to sidebar Skip to footer

Python: How To Only Loop Over First 'x' Items Of A Very Long List; Writing A Twitter Bot With Tweepy

Noob here. I'm sure this is a simple problem. I'm writing a Twitter bot with tweepy. I've hit a snag. I'm getting a 'Rate limit exceeded' error when I'm calling the api to make a l

Solution 1:

You can restrict tweepy's cursor limit like this:

# Only iterate through the first 200 followersfor follower in Cursor(api.followers).limit(200):
     follower_ids.append(follower.id)

This is pretty explicit in the docs, see here.

Post a Comment for "Python: How To Only Loop Over First 'x' Items Of A Very Long List; Writing A Twitter Bot With Tweepy"