Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过身份验证在R中下载数据?_R_Authentication - Fatal编程技术网

如何通过身份验证在R中下载数据?

如何通过身份验证在R中下载数据?,r,authentication,R,Authentication,我想从LendingClub(一家P2P借贷公司)下载安全数据,如果你对他们的工作感兴趣,请用谷歌搜索 只有您拥有帐户,才能下载受保护的数据。现在我有了一个用户名和密码,我检查下载页面以复制文件下载链接。那么我如何验证自己以下载数据?我尝试了以下方法: file <- 'lc1' url <- "https://www.lendingclub.com/fileDownload.action?type=gen&file=LoanStats3a_securev1.csv.zip"

我想从LendingClub(一家P2P借贷公司)下载安全数据,如果你对他们的工作感兴趣,请用谷歌搜索

只有您拥有帐户,才能下载受保护的数据。现在我有了一个
用户名
密码
,我检查下载页面以复制文件下载链接。那么我如何验证自己以下载数据?我尝试了以下方法:

file <- 'lc1'
url <- "https://www.lendingclub.com/fileDownload.action?type=gen&file=LoanStats3a_securev1.csv.zip"
download.file(url, file)
下载的文本文件不是我想要的zip文件,我想这是因为不涉及身份验证步骤,因为如果你没有帐户,你也可以下载部分数据,链接不同:

url <- "https://resources.lendingclub.com/LoanStats3a.csv.zip"
url您必须将它们与它们提供给您的API密钥一起使用

然后,您可以以您希望的格式(或者可以在代码中使用的格式)构建指向要下载的资源的URL

您可以使用curl双重检查您的URL:

$curl -v -H "Authorization: <api key>" -XGET https://api.lendingclub.com/api/investor/v1/accounts/<investor_id>/summary
$curl-v-H“授权:”-XGEThttps://api.lendingclub.com/api/investor/v1/accounts//summary

谢谢您的回答,我现在只有一个借款人帐户,但我仍然可以通过单击链接验证自己从浏览器下载受保护的文件。我是否必须获得API的投资者帐户才能在R中自动下载?据我所知,通过API借款人无法获得任何信息
$curl -v -H "Authorization: <api key>" -XGET https://api.lendingclub.com/api/investor/v1/accounts/<investor_id>/summary