RCurl, basic authentication with API key

后端 未结 1 907
春和景丽
春和景丽 2021-01-07 10:58

I used to use RCurl, to grab the data that needs login. Now I have to grab the data using api key (as well as userid,password) and it needs a basic authentication (Radian6 a

相关标签:
1条回答
  • 2021-01-07 11:08

    You might find it a little easier to use httr. The code would look something like this:

    library(httr)
    
    req <- GET("https://address.com/authenticate", 
      authenticate("user", "pass", type = "basic"),
      add_headers(auth_appkey = api_key))
    stop_for_status(req)
    content(req)
    # Then extract token etc
    
    0 讨论(0)
提交回复
热议问题