Mashvisor

免费增值
通过 Mashvisor | 已更新 25日前 | Data
人气

9.1 / 10

延迟

3,339ms

服务等级

94%

Health Check

N/A

返回所有讨论

A few comments on the R httr code | x_rapidapi and an issue with parentheses

Issue One: Parentheses

On every R code snippet provided by this RapidAPI page there is a misplaced parentheses. This is the code:

response <- VERB("GET", url, add_headers(x_rapidapi-key = 'RapidAPI Key REMOVED', x_rapidapi-host = 'mashvisor-api.p.rapidapi.com', '), query = queryString, content_type("application/octet-stream"))

The final parentheses before the closing bracket of function add_header() fucks up the code.

Issue 2: = signs

In the code theres a few occasions where one = is used when in R syntax it should be ==.

response <- VERB("GET", url, add_headers(x_rapidapi-key = 'RapidAPI Key REMOVED', x_rapidapi-host = 'mashvisor-api.p.rapidapi.com', ), query = queryString, content_type("application/octet-stream"))

should become

response <- VERB("GET", url, add_headers(x_rapidapi-key == 'RapidAPI Key REMOVED', x_rapidapi-host == 'mashvisor-api.p.rapidapi.com', ), query == queryString, content_type("application/octet-stream"))

Issue 3: x_rapidapi not recognized.

Whenever I run the code with the parentheses and == corrections, I get a return result that reads: Error in named(list(...)) : object 'x_rapidapi' not found

I’ve tried looking through httr documentation and I can’t figure out an answer. It seems that this might be a Rapid API issue and not an httr issue. Any thoughts on how I can get this code to run?

Rapid account: Rapidtom
rapidtom Commented 3年前

The code snippet is generated by RapidAPI and does have errors. Try using this instead:

response <- VERB("GET", url, add_headers('x-rapidapi-key' = 'API KEY GOES HERE', 'x-rapidapi-host' = 'mashvisor-api.p.rapidapi.com'), query = queryString, content_type("application/octet-stream"))

加入讨论 - 在下面添加评论:

登录/注册以发布新的评论