1

如何使用 twython 回复任何 twitter id?

这个很棒的 twython 库在 twitter 上发布状态更新的方法如下 -

    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')

只是想知道,如何使用 twython 回复推文?

4

1 回答 1

2

假设你有 twitter id,你可以简单地将 in_reply_to_status 添加到 update_status 函数中。

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')

这可以在这里找到。

此外,您应该查看 twython 包中的 endpoints.py 以获得更多使用 Twython 的功能。

于 2014-04-02T10:23:41.880 回答