【问题标题】:OAuth with httr package and twitter API v1.1带有 httr 包和 twitter API v1.1 的 OAuth
【发布时间】:2014-02-26 18:45:01
【问题描述】:

我正在尝试按照 httr 包中的演示来授权自己使用 twitter。但是,使用演示中的代码只会产生这个错误:

Response [https://api.twitter.com/1/statuses/home_timeline.json]
  Status: 410
  Content-type: application/json; charset=utf-8
{"errors": [{"message": "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]} 

需要更改代码中的哪些内容才能使其与 Twitter API v1.1 一起使用(请注意,下面的密钥和令牌来自演示,但我使用自己的来产生上面的错误)?

我也尝试过使用 Roauth 包,但它给了我与这里相同的错误:strsplit error when attempting to access Fitbit with ROAuth

myapp <- oauth_app("twitter", key = "TYrWFPkFAkn4G5BbkWINYw")

sig <- sign_oauth1.0(myapp,
  token = "69133574-FZ9GJlJ57V0SVdNAzo71mQZSUrpUbiJZBVpDmbYkd",
  token_secret = Sys.getenv("TWITTER_ACCESS_SECRET"))

GET("https://api.twitter.com/1/statuses/home_timeline.json", sig)

【问题讨论】:

    标签: r twitter httr roauth


    【解决方案1】:

    尝试使用 ...GET("https://api.twitter.com/1.1/statuses/home_timeline.json", sig) 代替(将 1 替换为 1.1)。

    【讨论】:

      猜你喜欢
      • 2013-04-15
      • 2011-09-06
      • 2015-02-14
      • 2021-05-04
      • 1970-01-01
      • 1970-01-01
      • 2021-09-20
      • 2012-09-17
      • 2015-03-07
      相关资源
      最近更新 更多