Ram Kumar
Ram Kumar

Reputation: 590

Using twython to reply to a given tweet

How can I use twython to post a reply to any twitter id?

The way to post a status update on twitter by this awesome twython library is as follows -

    try:
        a = twitter.update_status(status=message)
        return HttpResponse("1", content_type='text/plain')
    except TwythonError as e:
        return HttpResponse(e, content_type='text/plain')

Just wanted to know, how can I post a reply to a tweet using twython?

Upvotes: 1

Views: 2650

Answers (1)

oyvindym
oyvindym

Reputation: 352

Assuming you have the twitter id, you can simply do add in_reply_to_status to the update_status function.

try:
    a = twitter.update_status(status=message, in_reply_to_status_id=twitter_id)
    return HttpResponse("1", content_type='text/plain')
except TwythonError as e:
    return HttpResponse(e, content_type="'text/plain')

This can be found here.

Also, you should check out the endpoints.py in the twython package for more functions to use Twython.

Upvotes: 2

Related Questions