Replying on a tweet with Twython

Cecil Westerhof Cecil at decebal.nl
Sat Feb 17 15:27:52 EST 2018


Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:

> On Sat, 17 Feb 2018 12:53:08 +0100, Cecil Westerhof wrote:
>
>> Cecil Westerhof <Cecil at decebal.nl> writes:
>> 
>>> I just found Twython. I managed to post a tweet with:
>>>     from twython import Twython
>>>     twitter = Twython(APP_KEY, APP_SECRET,
>>>                       OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
>>>     posted = twitter.update_status(status = quote)
>>>
>>> But I want to send a reply on this tweet. I tried:
>>>         posted = twitter.update_status(status = follow_up, in_reply_id
>>>         = posted['id_str'])
>>>
>>> But that does not work. How could I make it work?
>
> Define "does not work". What happens when you try?

It is posted as a standalone tweet instead of as a reply on the first
tweet.


>> I need to use the following:
>>     posted = twitter.update_status(status = follow_up,
>>     in_reply_to_status_id = posted['id'])
>
> Okay. What happens when you try?

Then the tweet is posted as a reply on the the first tweet.

(So problem solved.)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list