httr v1.2.1

0

Monthly downloads

0th

Percentile

by Hadley Wickham

Tools for Working with URLs and HTTP

Useful tools for working with HTTP organised by HTTP verbs (GET(), POST(), etc). Configuration functions make it easy to control additional request components (authenticate(), add_headers() and so on).

Readme

httr

Build Status Coverage Status CRAN_Status_Badge

The aim of httr is to provide a wrapper for the curl package, 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 curl and libcurl. 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("hadley/httr")

Functions in httr

Name Description
BROWSE Open specified url in browser.
config Set curl options.
content Extract content from a request.
cookies Access cookies in a response.
cache_info Compute caching information for a response.
DELETE Send a DELETE request.
add_headers Add additional headers to a request.
GET GET a url.
content_type Set content-type and accept headers.
authenticate Use http authentication.
handle Create a handle tied to a particular host.
handle_pool Maintain a pool of handles.
http_status Give information on the status of a request.
http_condition Generate a classed http condition.
HEAD Get url HEADers.
http_error Check for an http error.
has_content Does the request have content associated with it?
hmac_sha1 HMAC SHA1
headers Extract the headers from a response
guess_media Guess the media type of a path from its extension.
init_oauth1.0 Retrieve OAuth 1.0 access token.
oauth_app Create an OAuth application.
insensitive Create a vector with case insensitive name matching.
httr_options List available options.
jwt_signature Generate a JWT signature given credentials.
httr_dr Diagnose common configuration problems
init_oauth2.0 Retrieve OAuth 2.0 access token.
http_type Extract the content type of a response
oauth_service_token Generate OAuth token for service accounts.
oauth_listener Create a webserver to listen for OAuth callback.
oauth2.0_token Generate an oauth2.0 token.
oauth_endpoints Popular oauth endpoints.
parse_http_date Parse and print http dates.
oauth_exchanger Walk the user through the OAuth2 dance without a local webserver.
oauth_endpoint Describe an OAuth endpoint.
oauth1.0_token Generate an oauth1.0 token.
oauth_signature Generate oauth signature.
oauth_callback The oauth callback url.
revoke_all Revoke all OAuth tokens in the cache.
RETRY Retry a request until it succeeds.
safe_callback Generate a safe R callback.
progress Add a progress bar.
response The response object.
PATCH Send PATCH request to a server.
parse_media Parse a media type.
timeout Set maximum request time.
httr httr makes http easy.
use_proxy Use a proxy to connect to the internet.
upload_file Upload a file with POST or PUT.
verbose Give verbose output.
status_code Extract status code from response.
stop_for_status Take action on http error.
with_config Execute code with configuration set.
sha1_hash SHA1 hash
sign_oauth Sign an OAuth request
user_agent Set user agent.
write_disk Control where the response body is written.
VERB VERB a url.
write_stream Process output in a streaming manner.
set_config Set (and reset) global httr configuration.
set_cookies Set cookies.
PUT Send PUT request to server.
modify_url Modify a url.
POST POST file to a server.
parse_url Parse and build urls according to RFC1808.
Token-class OAuth token objects.
write_function S3 object to define response writer.
No Results!

Last month downloads

Details

VignetteBuilder knitr
License MIT + file LICENSE
URL https://github.com/hadley/httr
RoxygenNote 5.0.1
NeedsCompilation no
Packaged 2016-07-03 17:01:25 UTC; hadley
Repository CRAN
Date/Publication 2016-07-03 22:33:34

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/httr)](http://www.rdocumentation.org/packages/httr)