Skip to content

Hi. It keep sleeping at one specific tweet and repeating sleeping... #1439

Answered by Harmon758
Geneseo asked this question in Questions
Discussion options

You must be logged in to vote

https://twitter.com/halfbare seems to only have around that many Tweets:

>>> user = api.get_user("halfbare")
>>> user.statuses_count
1550

Once your code reaches their earliest Tweet (which seems to be https://twitter.com/halfbare/status/1117195540448432128), your call to API.user_timeline will return an empty list since there are no older Tweets. Therefore, alltweets remains the same size, under 3200, and your while loop loops infinitely and spams requests to Twitter's GET statuses/user_timeline endpoint.

You should look into using a Cursor object to paginate instead.
See https://tweepy.readthedocs.io/en/latest/cursor_tutorial.html.

For code block usage, see https://docs.github.com/en/gi…

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 #1439 on December 16, 2020 10:40.