httr

R: fetching pdf documents from Companies House API

折月煮酒 提交于 2019-12-10 03:06:08
问题 I'm trying to fetch documents from the API using R. Appreciate the clarification of the process in this post. I've been following the above steps with partial success, but still fail the last step to get access to documents' content: Find the document filing you're interested in (e.g. make a filing history request1 for the company). Parse the response for the link to the document in the field "links" : { "document_metadata" : "link URI fragment here" }. No problem: library(httr) library

How to post within a rvest html_session?

南笙酒味 提交于 2019-12-09 23:04:48
问题 How can i post "within" a html session? So after i opened a session via a <- rvest::html_session(url) I tried: library(httr) POST(path, add_headers(setNames(as.character(headers(a)), names(headers(a)))), set_cookies(setNames(cookies(a)$value, cookies(a)$name)), body = list(...), encode = "json") But this handles my request as I were not logged in. Any suggestions? I am looking for something like POST(session, path, body, ...) 回答1: Ok, after some digging into it i solved it by using: x %>%

Authenticating google sheets on AWS Ubuntu without browser

大兔子大兔子 提交于 2019-12-09 14:11:05
问题 I'm running R Studio on an AWS "Ubuntu Server 12.04.2" and accessing R Studio via my browser. When I try to authenticate google auth API using the package googlesheets with the code: gs_auth(token = NULL, new_user = FALSE, key = getOption("googlesheets.client_id"), secret = getOption("googlesheets.client_secret"), cache = getOption("googlesheets.httr_oauth_cache"), verbose = TRUE) The problem here is that it redirects me to browser which is of local machine (windows based). Even if I

Extracting data from an API using R

梦想与她 提交于 2019-12-09 01:47:33
问题 I have access to some telemetry data in azure (specifically all the API calls for customers using a mobile app). I have used the httr package in R to request the data over a 3 minute period and assess the response like so (obviously have my own app ID and key which I have not included below): install.packages("httr") library(httr) r1 <- GET("https://api.applicationinsights.io/v1/apps/application-ID/query?timespan=PT0.05H&query=requests", add_headers("X-Api-Key" = "my-unique-key")) r1 #######

How to refresh or retry a specific web page using httr GET command?

和自甴很熟 提交于 2019-12-08 19:41:44
问题 I need to access the same web page with different "keys" to get specific content it provides. I have a list of keys x and I use the GET command from httr package to access the web page and then retrieve the information I need y . library(httr) library(stringr) library(XML) for (i in 1:20){ h1 = GET ( paste0("http:....categories=&query=", x[i]),timeout(10)) par = htmlParse(file = h1) y[i]=xpathSApply(doc = par, path = "//h3/a" , fun=xmlValue) } The problem is that timeout is often reached, and

Submit a form using POST with g-recaptcha-response argument

守給你的承諾、 提交于 2019-12-08 16:55:21
问题 I want to submit a form from following web page: http://www.hzzo-net.hr/statos_OIB.htm First, I use 2captcha service to bypass recaptcha: # parameters api_key <- "c+++" api_url <- "http://2captcha.com/in.php" site_key <- "6Lc3SAgUAAAAALFnYxUbXlcJ8I9grvAPC6LFTKQs" hzzo_url <- "http://www.hzzo-net.hr/statos_OIB.htm" # GET method req_url <- paste0("http://2captcha.com/in.php?key=", api_key,"&method=userrecaptcha&googlekey=", site_key, "&pageurl=", hzzo_url) get_response <- POST(req_url) hzzo

Use Mashape with R

十年热恋 提交于 2019-12-08 12:31:27
I'm trying to use the Mashape platform to access to different APIs with R (e.g. epguides or pipl). I could use directly the original APIs, but getting used to Mashape seems to be a good investment since it provides a unified access to a whole lot of other APIs. Two concerns however: Mashape doesn't provide any R tutorial. I tried the httr package to query Mashape but no success until there. How to query Mashape with R ? ; As far as I tested, most APIs endpoint on Mashape seem not to respond (even on the testing page provided by the platform). Is Mashape really reliable for every hosted API ?

Web scraping password protected website using R

孤街醉人 提交于 2019-12-08 11:31:42
问题 i would like to web scrap yammer data using R,but in order to do so first il have to login to this page,(which is authentication for an app that i created). https://www.yammer.com/dialog/authenticate?client_id=iVGCK1tOhbZGS7zC8dPjg I am able to get the yammer data once i login to this page but all this is in browser by standard yammer urls (https://www.yammer.com/api/v1/messages/received.json) I have read through similar questions and tried the suggestions but still cant get through this

How can I send a GET request without waiting for the response

点点圈 提交于 2019-12-07 22:04:31
问题 I am trying to run a GET request inside a shinyApp, but I don't want to wait for the response as it would take quite a long time to process and I dont need really need the response inside the shinyApp, although a status code would be nice, but it is not obligatory. Or is there maybe a function, that sends an async request? Like wrapping the whole GET inside a future/promise? Currently I have this observeEvent in my shinyApp: observeEvent(input$import, { httr::GET(url = "https://someurl/that

Downloading a file after login using a https URL

孤人 提交于 2019-12-07 07:05:36
问题 I am trying to download an excel file, which I have the link to, but I am required to log in to the page before I can download the file. I have successfully passed the login page with rvest, rcurl and httr, but I am having an extremely difficult time downloading the file after I have logged in. url <- "https://website.com/console/login.do" download_url <- "https://website.com/file.xls" session <- html_session(url) form <- html_form(session)[[1]] filled_form <- set_values(form, userid = user,