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 1 month 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 (over 11 years ago)
- Default Branch: main
- Last Pushed: 2025-12-18T23:16:35.000Z (3 months ago)
- Last Synced: 2026-01-11T11:32:42.919Z (3 months ago)
- Topics: http, http-client, http-requests, httping, r, rstats
- Language: R
- Homepage:
- Size: 69.3 KB
- Stars: 9
- Watchers: 3
- 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 = "#>"
)
```
[](https://cran.r-project.org/package=httping)
[](https://github.com/sckott/httping/actions/workflows/R-check.yaml)
[](https://github.com/r-hub/cranlogs.app)
[](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::pak("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://hb.cran.dev/post", 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
* License: MIT
* Please note that this project is released with a [Contributor Code of Conduct][coc]. By participating in this project you agree to abide by its terms.
[coc]: https://github.com/sckott/httping/blob/main/.github/CODE_OF_CONDUCT.md