我想GetDeepSearchResults从Zillow API 访问信息。
我的代码:
library(ZillowR)
zapi_key = getOption('Myapikey')
GetDeepSearchResults(
address = '600 S. Quail Ct.',
zipcode = '67114',
rentzestimate = FALSE,
api_key = zapi_key
)
Run Code Online (Sandbox Code Playgroud)
错误:
Error in GetDeepSearchResults(address = "600 S. Quail Ct.", zipcode = "67114", :
unused arguments (zipcode = "67114", api_key = zapi_key)
Run Code Online (Sandbox Code Playgroud)
为什么会发生此错误?我该怎么做才能解决此问题?
编辑:我根据注释更改了代码,并得到了:
我的代码:
library(ZillowR)
zapi_key = getOption('myapikey')
GetDeepSearchResults(
address = '600 S. Quail Ct.',
citystatezip = '67114',
rentzestimate = FALSE,
zws_id = 'myapikey',
url = "http://www.zillow.com/webservice/GetDeepSearchResults.htm"
)
Run Code Online (Sandbox Code Playgroud)
输出:
$request
$request$address
NULL
$request$citystatezip
NULL
$message
$message$text
[1] "Error: invalid or missing ZWSID parameter"
$message$code
[1] "2"
$response
NULL
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
当您传递参数时,未使用参数错误是典型的,这些参数不是函数的一部分。所以 R 不知道如何处理这些并返回错误。您可以使用以下命令查看该函数的文档?GetDeepSearchResults
这向您展示了用法:
Run Code Online (Sandbox Code Playgroud)GetDeepSearchResults(address = NULL, citystatezip = NULL, rentzestimate = FALSE, zws_id = getOption("ZillowR-zws_id"), url = "http://www.zillow.com/webservice/GetDeepSearchResults.htm")
要完成这项工作,您必须首先设置您的 id(您可以在https://www.zillow.com/howto/api/APIOverview.htm上创建一个 id ):
set_zillow_web_service_id("youractualkey")
Run Code Online (Sandbox Code Playgroud)
所以你的函数没有参数zipcodeand api_key。让我们将您的论点更改为现有的一些论点:
GetDeepSearchResults(address='600 S. Quail Ct.', citystatezip ='67114',
rentzestimate=FALSE)
Run Code Online (Sandbox Code Playgroud)
你肯定认识到我没有使用你的api_key。这是因为默认值:zws_id = getOption("ZillowR-zws_id")调用您'ZillowR-zws_id'刚刚使用set_zillow_web_service_id()命令设置的全局变量。所以没有必要改变默认值。但是当你使用zws_id ="youractualkey"zillow时你可以跳过这个
我随机创建了一个帐户来进行验证。这给了我输出:
$request
$request$address
NULL
$request$citystatezip
NULL
$message
$message$text
[1] "Error: this account is not authorized to execute this API call"
$message$code
[1] "6"
$response
NULL
Run Code Online (Sandbox Code Playgroud)
这样我就可以成功联系服务器并且我的密钥被识别。账户权限与R无关,必须在网站上设置。
| 归档时间: |
|
| 查看次数: |
184 次 |
| 最近记录: |