我要访问 GetDeepSearchResults
来自 Zillow API 的信息。
我的代码:
library(ZillowR)
zapi_key = getOption('Myapikey')
GetDeepSearchResults(
address = '600 S. Quail Ct.',
zipcode = '67114',
rentzestimate = FALSE,
api_key = zapi_key
)
错误:
Error in GetDeepSearchResults(address = "600 S. Quail Ct.", zipcode = "67114", :
unused arguments (zipcode = "67114", api_key = zapi_key)
为什么会出现这个错误?我能做些什么来解决这个问题?
编辑:我根据评论更改了代码并得到了这个:
我的代码:
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"
)
输出:
$request
$request$address
NULL
$request$citystatezip
NULL
$message
$message$text
[1] "Error: invalid or missing ZWSID parameter"
$message$code
[1] "2"
$response
NULL
我怎样才能解决这个问题?
最佳答案
当您传递不是函数的一部分的参数时,未使用的参数错误是典型的。所以 R 不知道如何处理这些并返回错误。您可以查看 documentation使用 ?GetDeepSearchResults
的函数
这向您展示了用法:
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")
所以你的函数没有参数
zipcode
和 api_key
.让我们将您的论点更改为存在的一些论点: GetDeepSearchResults(address='600 S. Quail Ct.', citystatezip ='67114',
rentzestimate=FALSE)
你肯定认得我没用你的
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
所以我可以成功联系服务器并且我的 key 被识别。账户权限与R无关,必须在网站上设置。
关于r - 如何在 ZillowR 中使用 zillow api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56894321/