question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

api.user_timeline not grabbing full tweet

See original GitHub issue

Hello, I am having an issue with not grabbing a full tweet when using the api.user_timeline method. Was wondering if anyone could help me out with it? Tweepy code is below:

twitter_name = input("Enter a Twitter Handle: ")
for name in twitter_name:
    try:
        stuff = api.user_timeline(screen_name = twitter_name, count = 100, include_rts = False)
    except tweepy.TweepError as e:
        twitter_name = input("The handle you entered was invalid, please try again: ")
    catchcount = 0

This returns the tweet followed by ‘…’ then a link. Ideally I would like to return the full tweet. Is there a way to do that while still using the api.user_timeline method? Or another method that allows specified tweet count and returns a list of Status objects without specifying a tweet ID number? like in the api.get_status method with param tweet_mode = 'extended' but for returning multiple tweets at a time.

Other info regarding similar issues see: #935 Much appreciated!!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
corycomercommented, Jan 14, 2018

You can include the tweet_mode = 'extended' param with most of the API calls, user_timeline included.

stuff = api.user_timeline(screen_name = twitter_name, count = 100, include_rts = False, tweet_mode = 'extended')

Should return the full tweet. Keep in mind, the response object is slightly different, and you’ll want to look for full_text instead of just text.

1reaction
Harmon758commented, Jul 31, 2019

I’ve added a section in the documentation that covers extended Tweets to supplement Twitter’s Tweet updates documentation.

@kamalikap What error are you referring to? It’s impossible to determine what your issue is without more information, such as a traceback and/or any relevant code. However, when using extended mode, the text attribute of the Status object is replaced with a full_text attribute, not full-text, which would be an invalid attribute name.

@puntofisso When using extended mode, the text attribute of the Status object is replaced with a full_text attribute.

For code block usage, see https://help.github.com/articles/creating-and-highlighting-code-blocks/.

@Nahaj That is not related to this issue.

If you’re using API.user_timeline, the maximum number of Tweets to try and retrieve per distinct request is 200, as specified for the documentation for the count parameter of the GET statuses/user_timeline endpoint that the method uses.

To retrieve more than 200, you’ll need to perform multiple requests and iterate through the pages. Tweepy provides a Cursor to facilitate pagination. See the Cursor Tutorial documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

api.user_timeline not grabbing full tweet - Stack Overflow
1 Answer 1 · I tried but it returns the following message: failed on_status, 'Status' object has no attribute 'full_text' Out[21]: · Try...
Read more >
Extended Tweets — tweepy 4.12.1 documentation
API methods is replaced by a full_text attribute, which contains the entire untruncated text of the Tweet. The truncated attribute of the Status...
Read more >
Trying to fetch 3200 Tweets with user_timeline
With the python code below I tried to fetch 3200 tweets from a public twitter profile, but so far I am always getting...
Read more >
GET statuses/user_timeline | Docs | Twitter Developer Platform
Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.
Read more >
How to get Tweets using Python and Twitter API
Getting Twitter data using Twitter API and the Tweepy library. ... So, some of the functionalities from v1.1 may not work with v2....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found