用 Tweepy 回复推文

编程入门 行业动态 更新时间:2024-10-28 16:16:52
本文介绍了用 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 供参考:code.google/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 回复推文

本文发布于:2023-06-08 21:22:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/589285.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Tweepy

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!