|
|
|
|
|
|
|
[![Project Status: Active – The project has reached a stable, usable
|
|
|
|
state and is being actively
|
|
|
|
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
|
|
|
|
[![Signed
|
|
|
|
by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/hrbrmstr)
|
|
|
|
![Signed commit
|
|
|
|
%](https://img.shields.io/badge/Signed_Commits-100%25-lightgrey.svg)
|
|
|
|
[![R-CMD-check](https://github.com/hrbrmstr/httr2curl/workflows/R-CMD-check/badge.svg)](https://github.com/hrbrmstr/httr2curl/actions?query=workflow%3AR-CMD-check)
|
|
|
|
[![Linux build
|
|
|
|
Status](https://travis-ci.org/hrbrmstr/httr2curl.svg?branch=master)](https://travis-ci.org/hrbrmstr/httr2curl)
|
|
|
|
![Minimal R
|
|
|
|
Version](https://img.shields.io/badge/R%3E%3D-3.6.0-blue.svg)
|
|
|
|
![License](https://img.shields.io/badge/License-MIT-blue.svg)
|
|
|
|
|
|
|
|
# httr2curl
|
|
|
|
|
|
|
|
Turn ‘httr’ Web Requests Into ‘curl’ Command Line Calls
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
|
|
|
When provided with an ‘httr’ “VERB” call, the request will be made and
|
|
|
|
‘libcurl’ headers will be captured and post-processed to provide a
|
|
|
|
working ‘curl’ command line call.
|
|
|
|
|
|
|
|
## What’s Inside The Tin
|
|
|
|
|
|
|
|
The following functions are implemented:
|
|
|
|
|
|
|
|
- `h2c`: Convert an ‘httr’ call to ‘curl’ command line
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
``` r
|
|
|
|
remotes::install_git("https://git.rud.is/hrbrmstr/httr2curl.git")
|
|
|
|
```
|
|
|
|
|
|
|
|
NOTE: To use the ‘remotes’ install options you will need to have the
|
|
|
|
[{remotes} package](https://github.com/r-lib/remotes) installed.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
``` r
|
|
|
|
library(httr2curl)
|
|
|
|
|
|
|
|
# current version
|
|
|
|
packageVersion("httr2curl")
|
|
|
|
## [1] '0.1.0'
|
|
|
|
```
|
|
|
|
|
|
|
|
### Using local perl
|
|
|
|
|
|
|
|
``` r
|
|
|
|
h2c(
|
|
|
|
httr::GET(
|
|
|
|
url = "https://rud.is/",
|
|
|
|
httr::user_agent(splashr::ua_apple_tv),
|
|
|
|
query = list(
|
|
|
|
a = "b",
|
|
|
|
c = 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
## [1] "/var/folders/bx/41ph1lms22q9mc83j5tx4bg80000gn/T//RtmpFs8uvt/fileced55b4fcbba"
|
|
|
|
## [1] "curl --http2 --header \"Accept: application/json, text/xml, application/xml, */*\" --compressed --user-agent \"AppleTV6,2/11.1\" \"https://rud.is/?a=b&c=1\"\n"
|
|
|
|
```
|
|
|
|
|
|
|
|
### Using the web service
|
|
|
|
|
|
|
|
``` r
|
|
|
|
h2c(
|
|
|
|
httr::GET(
|
|
|
|
url = "https://rud.is/",
|
|
|
|
httr::user_agent(splashr::ua_apple_tv),
|
|
|
|
query = list(
|
|
|
|
a = "b",
|
|
|
|
c = 1
|
|
|
|
)
|
|
|
|
),
|
|
|
|
use_web_service = TRUE
|
|
|
|
)
|
|
|
|
## [1] "/var/folders/bx/41ph1lms22q9mc83j5tx4bg80000gn/T//RtmpFs8uvt/fileced53c5bb06"
|
|
|
|
## NULL
|
|
|
|
```
|
|
|
|
|
|
|
|
## httr2curl Metrics
|
|
|
|
|
|
|
|
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
|
|
|
|
|:-----|---------:|-----:|----:|-----:|------------:|-----:|---------:|-----:|
|
|
|
|
| R | 5 | 0.36 | 52 | 0.25 | 21 | 0.25 | 40 | 0.26 |
|
|
|
|
| Rmd | 1 | 0.07 | 29 | 0.14 | 19 | 0.23 | 35 | 0.23 |
|
|
|
|
| YAML | 1 | 0.07 | 22 | 0.11 | 2 | 0.02 | 2 | 0.01 |
|
|
|
|
| SUM | 7 | 0.50 | 103 | 0.50 | 42 | 0.50 | 77 | 0.50 |
|
|
|
|
|
|
|
|
clock Package Metrics for httr2curl
|
|
|
|
|
|
|
|
## Code of Conduct
|
|
|
|
|
|
|
|
Please note that this project is released with a Contributor Code of
|
|
|
|
Conduct. By participating in this project you agree to abide by its
|
|
|
|
terms.
|