crul v1.0.0

0

Monthly downloads

0th

Percentile

HTTP Client

A simple HTTP client, with tools for making HTTP requests, and mocking HTTP requests. The package is built on R6, and takes inspiration from Ruby's 'faraday' gem (<https://rubygems.org/gems/faraday>). The package name is a play on curl, the widely used command line tool for HTTP, and this package is built on top of the R package 'curl', an interface to 'libcurl' (<https://curl.haxx.se/libcurl>).

Readme

crul

Project Status: Active - The project has reached a stable, usable state and is being actively developed. R-check codecov cran checks rstudio mirror downloads cran version

An HTTP client, taking inspiration from Ruby's faraday and Python's requests

Package documentation: https://docs.ropensci.org/crul/

Some Features:

  • HttpClient - Main interface to making HTTP requests. Synchronous requests only.
  • HttpResponse - HTTP response object, used for all responses across the different clients.
  • Paginator - Auto-paginate through requests - supports a subset of all possible pagination scenarios - will fill out more scenarios soon
  • Async - Asynchronous HTTP requests - a simple interface for many URLS - whose interface is similar to HttpClient - all URLs are treated the same.
  • AsyncVaried - Asynchronous HTTP requests - accepts any number of HttpRequest objects - with a different interface than HttpClient/Async due to the nature of handling requests with different HTTP methods, options, etc.
  • set curl options globally: set_auth(), set_headers(), and more
  • Writing to disk and streaming: available with both synchronous requests as well as async requests
  • Hooks on requests and responses are available in the HttpClient method only, and allow you to trigger functions to run on requests or responses, or both. See ?hooks for the details and examples
  • Mocking: crul integrates with webmockr to mock HTTP requests. Checkout the http testing book
  • Test caching: crul also integrates with vcr to cache http requests/responses. Checkout the http testing book

Installation

CRAN version

install.packages("crul")

Latest binaries from rOpenSci

install.packages("crul", repos = "https://dev.ropensci.org")

Dev version from GitHub

remotes::install_github("ropensci/crul")
library("crul")

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for crul in R doing citation(package = 'crul')
  • Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
  • Where does the package name come from? It was a play on "curl", the popular command line client.
  • Where does the sticker design come from? The sticker idea arose from a tweet - crul is close (ish) to Krull, a 1980's movie with a "mystical five-pointed weapon". The association with Krull was not known before naming the package.

ropensci_footer

Functions in crul

Name Description
content-types Working with content types
auth Authentication
Async Simple async client
cookies Working with cookies
Paginator Paginator client
HttpResponse Base HTTP response object
HttpClient HTTP client
AsyncVaried Async client for different request types
HttpRequest HTTP request object
AsyncQueue AsyncQueue
curl-options curl options
hooks Event Hooks
upload upload file
handle Make a handle
proxies proxy options
verb-DELETE HTTP verb info: DELETE
url_build Build and parse URLs
crul-package crul
crul-options Set curl options, proxy, and basic auth
verb-HEAD HTTP verb info: HEAD
verb-GET HTTP verb info: GET
ok check if a url is okay
http-headers Working with HTTP headers
mock Mocking HTTP requests
curl_verbose curl verbose method
verb-POST HTTP verb info: POST
verb-PATCH HTTP verb info: PATCH
verb-PUT HTTP verb info: PUT
progress progress bars
writing-options Writing data options
No Results!

Vignettes of crul

Name
async.Rmd
async.Rmd.og
best-practices-api-packages.Rmd
best-practices-api-packages.Rmd.og
choosing-a-client.Rmd
choosing-a-client.Rmd.og
crul.Rmd
crul.Rmd.og
curl-options.Rmd
curl-options.Rmd.og
how-to-use-crul.Rmd
how-to-use-crul.Rmd.og
No Results!

Last month downloads

Details

License MIT + file LICENSE
URL https://docs.ropensci.org/crul (website) https://github.com/ropensci/crul (devel) https://books.ropensci.org/http-testing/ (user manual)
BugReports https://github.com/ropensci/crul/issues
Encoding UTF-8
Language en-US
VignetteBuilder knitr
RoxygenNote 7.1.1
X-schema.org-applicationCategory Web
X-schema.org-keywords http, https, API, web-services, curl, download, libcurl, async, mocking, caching
X-schema.org-isPartOf https://ropensci.org
NeedsCompilation no
Packaged 2020-07-30 21:22:31 UTC; sckott
Repository CRAN
Date/Publication 2020-07-30 21:50:03 UTC

Include our badge in your README

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