【发布时间】:2021-08-09 21:54:59
【问题描述】:
我正在尝试使用 R 中的 httr 包访问 RapidAPI,如下所示:
library(httr)
url <- "https://extract-news.p.rapidapi.com/v0/article"
queryString <- list(url = "https://www.theverge.com/2020/4/17/21224728/bill-gates-coronavirus-lies-5g-covid-19")
response <- VERB("GET", url, addheaders(x_rapidapi_key ="my-api-key", x_rapidapi_host = "extract-news.p.rapidapi.com"), query = queryString, contenttype("application/octet-stream"))
content(response, "text")
我也尝试访问其他 API。但是,我不断收到此错误消息:
Status: 401
您能帮我解决这个问题吗? 提前非常感谢!
【问题讨论】:
-
您的 api 密钥可能存在问题。它可能已过期或其他原因。 developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
-
谢谢@dcruvolo!我检查了,但无法检测到我的 api 密钥有任何问题。任何其他想法可能是什么问题?
标签: r http-status-code-401 httr rapidapi