def limit_handled(cursor): """ :param cursor: A cursor to iterate :type cursor: tweepy.Cursor """ while True: try: yield cursor.next() except tweepy.RateLimitError: sleep(60)