Skip to content
Advertisement

Reply to Tweet with Tweepy – Python

I can’t seem to get tweepy to work with replying to a specific tweet:

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)

api = tweepy.API(auth)

### at this point I've grabbed the tweet and loaded it to JSON...

tweetId = tweet['results'][0]['id']

api.update_status('My status update',tweetId)

The api says it takes optional parameters and in_reply_to_status_id is the first, but it seems to be ignoring it altogether. This script will post an updated status, but it does not link it as a reply to the tweetId that I’m passing.

API for reference: http://code.google.com/p/tweepy/wiki/APIReference#update_status

Anyone have any ideas? I feel like I’m missing something simple here…

Thanks in advance.

Advertisement

Answer

Well then, it was something simple. I had to specify who the tweet was directed towards using the @ notation.

api.update_status('My status update @whoIReplyTo',tweetId) 
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement