【问题标题】:Is there a way to call a custom Twitter endpoint using Tweepy?有没有办法使用 Tweepy 调用自定义 Twitter 端点?
【发布时间】:2017-11-28 13:22:30
【问题描述】:

我正在使用 Tweepy 在 Python 中从 Twitter 中提取一些数据。我想从statuses/retweeters/ids 端点提取数据,但是,Tweepy 似乎没有内置这个端点。

有没有一种方法可以调用自定义端点,以便我可以使用这个端点,而不仅仅是 Tweepy 中的 API.retweets() 端点,它会拉取转发?我正在寻找转发特定推文的人的个人用户 ID。

谢谢!

【问题讨论】:

    标签: python twitter tweepy


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-03-06
      • 2021-03-28
      • 1970-01-01
      • 2020-11-06
      • 2022-08-20
      • 2019-09-05
      • 1970-01-01
      • 2023-01-26
      • 1970-01-01
      相关资源
      最近更新 更多