我正在设计一个闪亮的应用程序,它会将你附近的前10个酒吧从yelp中拉出来,并在列表中提供给你。我试图让它接受一个地址作为输入。我目前正在服务器端工作,当我尝试使用此代码提取结果时,它会抛出此错误:
"错误:没有方法asJSON S3类:XMLAbstractDocument"
所以当我尝试调用前一步的locationdataList时,它会给我一个更长的错误消息,说我的签名无效。请帮忙!这是代码(故意隐藏的API信息):
consumerKey = "xxxx"
consumerSecret = "xxxx"
token = "xxxx"
token_secret = "xxxx"
require(httr)
require(httpuv)
require(jsonlite)
# authorization
myapp = oauth_app("YELP", key=consumerKey, secret=consumerSecret)
sig=sign_oauth1.0(myapp, token=token,token_secret=token_secret)
location <- "9500 Gilman Dr, San Diego CA 92092"
# 10 bars most near
proxGet <- paste0("http://api.yelp.com/v2/search/?limit=10&term=bar&location=",location,"&")
locationdata=GET(proxGet, sig)
locationdataContent = content(locationdata)
locationdataList=jsonlite::fromJSON(toJSON(locationdataContent))
head(data.frame(locationdataList))