Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sckott/httping
Ping urls to time requests
https://github.com/sckott/httping
http http-client http-requests httping r rstats
Last synced: about 19 hours ago
JSON representation
Ping urls to time requests
- Host: GitHub
- URL: https://github.com/sckott/httping
- Owner: sckott
- License: other
- Created: 2014-12-03T07:30:22.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2022-11-04T21:19:56.000Z (about 2 years ago)
- Last Synced: 2024-11-01T21:51:05.248Z (8 days ago)
- Topics: http, http-client, http-requests, httping, r, rstats
- Language: R
- Homepage:
- Size: 56.6 KB
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - sckott/httping - Ping urls to time requests (R)
README
httping
=======```{r echo=FALSE}
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>"
)
```[![cran checks](https://badges.cranchecks.info/worst/httping.svg)](https://cloud.r-project.org/web/checks/check_results_httping.html)
[![R-check](https://github.com/sckott/httping/actions/workflows/R-check.yaml/badge.svg)](https://github.com/sckott/httping/actions/workflows/R-check.yaml)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/httping?color=C9A115)](https://github.com/metacran/cranlogs.app)
[![cran version](https://www.r-pkg.org/badges/version/httping)](https://cran.r-project.org/package=httping)`httping` is a tiny R package to Ping urls to time requests. It's a port of the Ruby gem [httping](https://github.com/jpignata/httping).
## Install
CRAN stable version
```{r eval=FALSE}
install.packages("httping")
```Development version from Github
```{r eval=FALSE}
install.packages("pak")
pak::pkg_install("sckott/httping")
``````{r}
library("httping")
library("httr")
```## Pass any httr request to time
A `GET` request
```{r}
GET("https://google.com") %>% time(count = 3)
```A `POST` request
```{r}
POST("https://mockbin.com/request", body = "A simple text string") %>% time(count = 3)
```The return object is a list with slots for all the `httr` response objects, the times for each request, and the average times. The number of requests, and
the delay between requests are included as attributes.```{r}
res <- GET("http://google.com") %>% time(count = 3)
attributes(res)
```Or print a summary of a response, gives more detail
```{r}
res %>% summary()
```Messages are printed using `cat`, so you can suppress those using `verbose=FALSE`, like
```{r}
GET("https://google.com") %>% time(count = 3, verbose = FALSE)
```## Ping an endpoint
This function is a bit different, accepts a url as first parameter, but can accept any args passed on to `httr` verb functions, like `GET`, `POST`, etc.
```{r}
"https://google.com" %>% ping()
```Or pass in additional arguments to modify request
```{r}
"https://google.com" %>% ping(config = verbose())
```## Meta
* Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.