I am trying to use Twython to retrieve the last tweet an account makes. My current code is:
try:
user_timeline = twitter.get_user_timeline(screen_name='Twitter')
except TwythonError as e:
print e
for tweets in user_timeline:
print tweets['text'].encode('utf-8')
However, while I do get the tweets in the desired text format, the for loop I am using returns the users last 20 tweets. I only need the last tweet made by the user.
I am a complete Noob to Python, so any help is appreciated. I have had a difficult time tracking down example code so any pointers on that, too, would be appreciated.
You must use the count argument in the call to the get_user_timeline function. It should works.