我正在使用 Tweepy 在 Python 中从 Twitter 中提取一些数据。我想从 statuses/retweeters/ids 端点提取数据,但是,看起来 Tweepy 没有内置此端点。
有没有一种方法可以调用自定义端点,以便我可以使用此端点,而不仅仅是 Tweepy 中用于拉取转推的 API.retweets() 端点?我正在寻找转推特定推文的人的个人用户 ID。
谢谢!
请您参考如下方法:
查看 tweepy 库代码以及 API 方法的定义方式,我想您可以试试这个:
import tweepy
from tweepy.binder import bind_api
# OAuth process
auth = tweepy.OAuthHandler('key', 'secret')
auth.secure = True
auth.set_access_token('token', 'token_secret')
# Creation of the interface
api = tweepy.API(auth)
# Call of the custom endpoint
bind_api(
api=api,
path='/statuses/retweeters/ids',
method='GET',
allowed_param=['id', 'count', 'cursor', 'stringify_ids'],
require_auth=True
)
