Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SinceIdIterator should yield responses as they are fetched #10

Open
osamak opened this issue Jun 7, 2017 · 2 comments
Open

SinceIdIterator should yield responses as they are fetched #10

osamak opened this issue Jun 7, 2017 · 2 comments

Comments

@osamak
Copy link

osamak commented Jun 7, 2017

I am trying to fetch the complete favorite list, using the following code:

response_pool = client.api.favorites.list.get.iterator.with_since_id(screen_name=USERNAME,
                                                                     count=200,
                                                                     _force=False)
async for response in response_pool:
    for status in response:
        print(status)

Using the previous code snippet, IdIterators (i.e. MaxIdIterator and SinceIdIterator) will not yield any status until all statuses fetched, which goes against the purpose of iteration.

I am not sure if I am missing something, but statuses should be allowed to be processed before the complete list is fetched, to maximize the benefit of iteration.

@odrling
Copy link
Owner

odrling commented Jun 7, 2017

For SinceIdIterators the iterator makes several requests to fill gaps in the responses (for example when there is more than 200 tweets sent between 2 iterations) by using a MaxIdIterator. You can disable this behavior by setting the _fill_gaps parameter of the iterator to False. Maybe this should be the default value of this parameter?

Other iterators only make one request to twitter for each iteration so it should be alright for MaxIdIterator and CursorIterator.

@odrling
Copy link
Owner

odrling commented Jun 30, 2017

Actually shouldn't you be using max_id for this request if you want to get all the favorites?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants