Skip to content

How to save Cursor Object to resume later. #1470

Answered by Harmon758
Srj asked this question in Questions
Discussion options

You must be logged in to vote

If the pagination is by ID, as is the case with API.search:

tweepy/tweepy/binder.py

Lines 257 to 267 in 1a71938

# Set pagination mode
if 'cursor' in APIMethod.allowed_param:
if APIMethod.payload_type == 'direct_message':
_call.pagination_mode = 'dm_cursor'
else:
_call.pagination_mode = 'cursor'
elif 'max_id' in APIMethod.allowed_param:
if 'since_id' in APIMethod.allowed_param:
_call.pagination_mode = 'id'
elif 'page' in APIMethod.allowed_param:
_call.pagination_mode = 'page'
Then the iterator you're using is an IdIterator returned by Cursor.pages:

tweepy/tweepy/cursor.py

Lines 9 to 23 in 1a71938

class Cursor(ob…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Harmon758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question This is a question Discussion This was converted/moved from/to a discussion
2 participants
Converted from issue

This discussion was converted from issue #1470 on December 16, 2020 07:09.