gpt4 book ai didi

r - R & Ravelry 中的 API

转载 作者:行者123 更新时间:2023-12-04 09:21:32 26 4
gpt4 key购买 nike

我正在尝试使用 Ravelry API 进行一些数据分析,但我遇到了困难。

我正在根据 this link 对我的代码进行建模但恐怕这个博客可能是在 Ravelry API 上有不同类型的权限之前写的。

我有一个 OAuth 1.0a API,其中包含一个包含我的用户名、 key 和 secret 的文本文件

library(httr)

# user_rav.txt contains API username and password
credentials <- readLines("user_rav.txt")
names(credentials) <- c("user","access_key","secret_key")

OpenConnection <- function(credentials){
# Args: login info for the Ravelry API
# Returns oauth token
# Open connection to Ravelry API and return token
reqURL <- "https://www.ravelry.com/oauth/request_token"
accessURL <- "https://www.ravelry.com/oauth/access_token"
authURL <- "https://www.ravelry.com/oauth/authorize"

ravelry.app <- oauth_app("ravelry", key=credentials["access_key"],
secret=credentials["secret_key"])
ravelry.urls <- oauth_endpoint(reqURL, authURL, accessURL)

return(oauth1.0_token(ravelry.urls, ravelry.app))
}

# Quick test of API connection by getting connected user info
TestConnection <- function(ravelry.token) {
# Arg: API token
# Returns name of the user connected with this token
test <- GET("https://api.ravelry.com/current_user.json",
config=config("token"=ravelry.token))
print(content(test)$user$username)
}

ravelry.token <- OpenConnection(credentials)

最后一行“ravelry.token <- OpenConnection(credentials)”产生了这个错误:

 Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission,  : 
Internal Server Error (HTTP 500).

我用谷歌搜索了这个错误,如果你相信的话,只有四次点击。两个不可用,其他特定于具有我未使用的 API 的 R 包。

如有任何帮助,我将不胜感激。

最佳答案

我道歉。它就像需要编辑的凭证文件中的列标题一样简单。

关于r - R & Ravelry 中的 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59686243/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com