Questions tagged [httr]

The R package 'httr' provides useful tools for working with HTTP connections. It is a simplified wrapper built on top of 'RCurl'.

The R package httr provides useful tools for working with HTTP connections. It is a simplified wrapper built on top of RCurl. It is much much less configurable but because it only attempts to encompass the most common operations it is also much much simpler.

Resources:

1019 questions
7
votes
1 answer

R: Emulating a complex form with httr

I am trying to get the results of that form with httr. Having looked the form results, I tried the following: library(httr) library(stringr) r = str_c("http://www.memoiredeshommes.sga.defense.gouv.fr/fr/arkotheque/", …
Fr.
  • 2,865
  • 2
  • 24
  • 44
7
votes
3 answers

How to remove cookies preserved by httr::GET?

httr::GET preserves cookies when making requests to the same website. Is it possible to query those preserved cookies? How can I flush those preserved cookies and make "pristine" requests again? Example: # Get login cookie r1 <-…
Michał
  • 2,755
  • 1
  • 17
  • 20
7
votes
3 answers

Using an API to calculate distance between two airports (two columns) within R?

I was wondering whether there was a way to compare airport distances(IATA codes). There are some scripts but not is using R. So I tried that with with the API: developer.aero Example data: library(curl) # for curl post departure <-…
7
votes
3 answers

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

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…
Felipe Alvarenga
  • 2,572
  • 1
  • 17
  • 36
7
votes
1 answer

Asynchronous POST Requests - R, using RCurl?

I am trying to make async requests to a REST API from R. The below curl command illustrates the parameters that I need to the pass to the api. I'm giving you guys the linux curl command as I'm hoping that will make it clear: curl -v -X POST…
hamel
  • 1,288
  • 1
  • 12
  • 16
7
votes
1 answer

How to POST multipart/related content with httr (for Google Drive API)

I got simple file uploads to Google Drive working using httr. The problem is that every document is uploaded as "untitled", and I have to PATCH the metadata to set the title. The PATCH request occasionally fails. According to the API, I ought to be…
iaina
  • 165
  • 2
  • 9
7
votes
2 answers

r language support for AWS DynamoDB

This is a follow up / updated question to this: AWS dynamodb support for "R" programming language I am looking for examples or documentation on how to read in a table from DynamoDB into R. This question pointed me in the right direction: R + httr…
JayCo
  • 784
  • 7
  • 22
6
votes
1 answer

Spotify authentication in github actions

I'm trying to write an R package that can be run in a headless environment like Github Actions. Using httr you can authenticate with the Spotify API in an interactive session with the below code (stolen from spotifyr) get_spotify_authorization_code…
Conor Neilson
  • 1,026
  • 1
  • 11
  • 27
6
votes
4 answers

Check if URL exists in R

I want to loop over a list of URLs and I want to find out if these URLs exist or not. RCurl provides the url.exists() function. However, the output doesn't seem to be right, because for example it says that amazon.com is not registered (it does so…
J. Doe
  • 169
  • 2
  • 6
6
votes
1 answer

Downloading a file after login using a https URL

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…
dmunslow
  • 149
  • 1
  • 7
6
votes
4 answers

R rvest: could not find function "xpath_element"

I am trying to simply replicate the example of rvest::html_nodes(), yet encounter an error: library(rvest) ateam <- read_html("http://www.boxofficemojo.com/movies/?id=ateam.htm") html_nodes(ateam, "center") Error in do.call(method,…
Matifou
  • 7,968
  • 3
  • 47
  • 52
6
votes
2 answers

How to override exported function from R package listed in Imports

My package's DESCRIPTION file has httr in its Imports directive: Imports: httr (>= 1.1.0), jsonlite, rstudioapi httr exports an S3method for length.path. S3method(length,path) And it's defined as: #' @export length.path <- function(x)…
Nicole White
  • 7,720
  • 29
  • 31
6
votes
1 answer

Using a JSON array in a POST request

I'm writing an API wrapper to query UK postcodes using httr package and everything works fine when I use GET requests. I'm slightly lost when it comes to using a POST request. Here's what the documentation of the API says: Accepts a JSON object…
epo3
  • 2,991
  • 2
  • 33
  • 60
6
votes
3 answers

Error connecting to azure blob storage API from R

I am attempting to work with Azure storage via the REST API in R. I'm using the package httr which overlays Curl. Setup You can use R-fiddle: http://www.r-fiddle.org/#/fiddle?id=vh8uqGmM library(httr) requestdate<-format(Sys.time(),"%a, %d %b %Y…
Steph Locke
  • 5,951
  • 4
  • 39
  • 77
6
votes
1 answer

How to properly set cookies to get URL content using httr

I need to download information from web site that is protected using cookies. I pass this protection manually and then insert cookies to httr. Here is similar topic, but it does not solve my problem: (Copying cookie for…
VadymB
  • 75
  • 1
  • 4