Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sckott/httpcode

http status code investigation
https://github.com/sckott/httpcode

http r rstats

Last synced: about 1 month ago
JSON representation

http status code investigation

Awesome Lists containing this project

README

        

httpcode
========

```{r echo=FALSE}
library("knitr")
hook_output <- knitr::knit_hooks$get("output")
knitr::knit_hooks$set(output = function(x, options) {
lines <- options$output.lines
if (is.null(lines)) {
return(hook_output(x, options)) # pass to default hook
}
x <- unlist(strsplit(x, "\n"))
more <- "..."
if (length(lines)==1) { # first n lines
if (length(x) > lines) {
# truncate the output, but add ....
x <- c(head(x, lines), more)
}
} else {
x <- c(if (abs(lines[1])>1) more else NULL,
x[lines],
if (length(x)>lines[abs(length(lines))]) more else NULL
)
}
# paste these lines together
x <- paste(c(x, ""), collapse = "\n")
hook_output(x, options)
})

knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>"
)
```

[![cran checks](https://badges.cranchecks.info/worst/httpcode.svg)](https://cloud.r-project.org/web/checks/check_results_httpcode.html)
[![R-check](https://github.com/sckott/httpcode/actions/workflows/R-check.yaml/badge.svg)](https://github.com/sckott/httpcode/actions/workflows/R-check.yaml)
[![codecov](https://codecov.io/gh/sckott/httpcode/branch/master/graph/badge.svg?token=gvEuPJXQuK)](https://codecov.io/gh/sckott/httpcode)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/httpcode)](https://github.com/metacran/cranlogs.app)
[![cran version](https://www.r-pkg.org/badges/version/httpcode)](https://cran.r-project.org/package=httpcode)

`httpcode` is a tiny R package to search for and show http code messages and description. It's a port of the Python httpcode (https://github.com/rspivak/httpcode) library.

`httpcode` has no dependencies.

Follows RFC 2616 (https://www.ietf.org/rfc/rfc2616.txt), and for additional codes
following RFC 6585 (https://tools.ietf.org/html/rfc6585).

Structure of information for each status code:

* `status_code` - the status code
* `message` - very brief message explaining the code
* `explanation` - more verbose explanation, but still short
* `explanation_verbose` - the complete explanation

## Installation

Stable version

```{r eval=FALSE}
install.packages("httpcode")
```

Development version

```{r eval=FALSE}
install.packages("pak")
pak::pkg_install("sckott/httpcode")
```

```{r}
library("httpcode")
```

## Search by http code

```{r}
http_code(100)
```

```{r}
http_code(400)
```

```{r}
http_code(503)
```

```{r}
http_code(999)
```

## Get verbose status code description

```{r}
http_code(100, verbose = TRUE)
```

```{r}
http_code(400, verbose = TRUE)
```

# Fuzzy code search

```{r}
http_code('1xx')
```

```{r output.lines = 1:10}
http_code('3xx')
```

```{r}
http_code('30[12]')
```

```{r}
http_code('30[34]')
```

## Search by message

```{r output.lines = 1:10}
http_search("request")
```

```{r}
http_search("forbidden")
```

```{r}
http_search("too")
```

```{r}
http_search("birds")
```

## Bugs/features?

See [issues](https://github.com/sckott/httpcode/issues)

## Code of Conduct

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/httpcode/blob/main/CODE_OF_CONDUCT.md