【问题标题】:strsplit error when attempting to access Fitbit with ROAuth尝试使用 ROAuth 访问 Fitbit 时出现 strsplit 错误
【发布时间】:2013-06-02 10:45:43
【问题描述】:

我正在尝试使用 ROAuth 访问 fitbit API,但一直遇到第一个障碍。

这是我的代码:

library(ROAuth)

reqURL <- "https://api.fitbit.com/oauth/request_token"
accessURL <- "https://api.fitbit.com/oauth/access_token"
authURL <- "https://www.fitbit.com/oauth/authorize"
cKey <- "xxxxx"
cSecret <- "xxxxx"

credentials <- OAuthFactory$new(consumerKey=cKey,
                            consumerSecret=cSecret,
                            requestURL=reqURL,
                            accessURL=accessURL,
                            authURL=authURL)
credentials$handshake()

运行它会产生以下相当神秘的错误:

Error in strsplit(response, "&") : non-character argument

任何建议,不胜感激!

【问题讨论】:

  • 我会做类似options(error = recover) 的事情,并尝试在其被调用的环境中评估response 表达式。
  • 响应 [1] 6f 61 ... [100] 75 74 ... 64 3d 74 72 75 65 attr(,"Content-Type") 字符集 "application/x-www-form- urlencoded" "UTF-8"
  • 这是response 的编辑摘录。不知道该怎么做!
  • 您可能会发现在 httr 中使用 OAuth 支持更容易。
  • 非常感谢@hadley,我会试试的。

标签: r oauth fitbit


【解决方案1】:

按照@hadley 的建议,我没有解决ROAuth 问题,而是改用httr 包。 this question 中的代码对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-19
    • 2018-07-17
    • 1970-01-01
    • 1970-01-01
    • 2010-10-17
    • 2021-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多