Skip to content
/ httr Public
forked from r-lib/httr

httr: a friendly http package for R

License

Notifications You must be signed in to change notification settings

wja123/httr

 
 

Repository files navigation

httr

Build Status

The aim of httr is to provide a wrapper for RCurl customised to the demands of modern web APIs.

Key features:

  • Functions for the most important http verbs: GET(), HEAD(), PATCH(), PUT(), DELETE() and POST().

  • Automatic connection sharing across requests to the same website (by default, curl handles are managed automatically), cookies are maintained across requests, and a up-to-date root-level SSL certificate store is used.

  • Requests return a standard reponse object that captures the http status line, headers and body, along with other useful information.

    • Response content is available with content() as a raw vector (as = "raw"), a character vector (as = "text"), or parsed into an R object (as = "parsed"), currently for html, xml, json, png and jpeg.

    • You can convert http errors into R errors with stop_for_status().

  • Config functions make it easier to modify the request in common ways: set_cookies(), add_headers(), authenticate(), use_proxy(), verbose(), timeout(), content_type(), accept(), progress().

  • Support for OAuth 1.0 and 2.0 with oauth1.0_token() and oauth2.0_token(). The demo directory has eight OAuth demos: four for 1.0 (twitter, vimeo, withings and yahoo) and four for 2.0 (facebook, github, google, linkedin). OAuth credentials are automatically cached within a project.

httr wouldn't be possible without the hard work of the authors of RCurl and curl. Thanks! httr is inspired by http libraries in other languages, such as Resty, Requests and httparty.

Installation

To get the current released version from CRAN:

install.packages("httr")

To get the current development version from github:

# install.packages("devtools")
devtools::install_github("jeroenooms/curl")
devtools::install_github("hadley/httr")

Updating ca-bundle.crt

httr includes a recent CA certificate bundle from mozilla.org. Run this code to update the package:

GET("https://github.com/bagder/ca-bundle/raw/e9175fec5d0c4d42de24ed6d84a06d504d5e5a09/ca-bundle.crt",
  write_disk("inst/cacert.pem", overwrite = TRUE))

Around early September 2014, Mozilla removed the trust bits from the certs in their CA bundle that were still using RSA 1024 bit keys. This leads to problems on Windows, so we use an older version.

About

httr: a friendly http package for R

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 99.4%
  • Rebol 0.6%