开发者

How to read a CSV in R from HTTP with AUTH

开发者 https://www.devze.com 2023-03-05 02:44 出处:网络
I\'m trying to read a CSV with R from a URL that has auth, I do have the password and everything I just need to know what to add to the command, btw my password does include the @ char so it messed up

I'm trying to read a CSV with R from a URL that has auth, I do have the password and everything I just need to know what to add to the command, btw my password does include the @ char so it messed up my scheme [1]

This is the command I'm trying:

products <- read.csv("http://username:pass@word@domain.com/api/products_by_date.csv?start_date=2011-04-01&end_date=2011-04-01", head=TRUE)

开发者_JS百科My output is:

Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : unable to resolve 'username'

[1] scheme://username:password@domain:port/path?query_string#fragment_id


you can try getURL in the RCurl package, which has the functionality to authenticate HTTP requests. see ?getURL for an example.

0

精彩评论

暂无评论...
验证码 换一张
取 消