Twython' object has no attribute 'getUserTimeline'

I'm trying to create a bot that will retweet and promote some of my other accounts. But i receive the below error

AttributeError: 'Twython' object has no attribute 'getUserTimeline'

my code is:

search_results = twitter.getUserTimeline(sreen_name="SCREENNAME", count = 2,)
try:
for tweet in search_results["statuses"]:
    twitter.retweet(id = tweet["id_str"])
except TwythonError as e:
    print e

Can anyone help?

2 answers

  • answered 2017-10-11 10:14 Jonas

    In your code snippet you do not define twitter.

    Try this:

    from twython import Twython
    twitter = Twython()
    search_results = twitter.getUserTimeline(sreen_name="SCREENNAME", count = 2,)
    

  • answered 2017-10-11 10:14 Manuel Rendon

    According to the twithon documentation there is no getUserTimeline function there is however a get_user_timeline function.

    You should change the following call:

    twitter.getUserTimeline 
    

    to be:

    twitter.get_user_timeline