用 Tweepy 回复推文 - Python [英] Reply to Tweet with Tweepy - Python

查看:26
本文介绍了用 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)

api 说它需要可选参数,而 in_reply_to_status_id 是第一个,但它似乎完全忽略了它.此脚本将发布更新的状态,但不会将其链接为对我传递的 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 供参考:http://code.google.com/p/tweepy/wiki/APIReference#update_status

有人有什么想法吗?我觉得我在这里遗漏了一些简单的东西...

Anyone have any ideas? I feel like I'm missing something simple here...

提前致谢.

推荐答案

好吧,事情很简单.我必须使用@ 表示法指定推文的对象是谁.

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) 

这篇关于用 Tweepy 回复推文 - Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆