https://github.com/sckott/httpcode
http status code investigation
https://github.com/sckott/httpcode
http r rstats
Last synced: 5 months ago
JSON representation
http status code investigation
- Host: GitHub
- URL: https://github.com/sckott/httpcode
- Owner: sckott
- License: other
- Created: 2014-11-29T20:59:17.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2023-05-18T21:14:18.000Z (almost 2 years ago)
- Last Synced: 2024-06-11T16:08:20.695Z (10 months ago)
- Topics: http, r, rstats
- Language: R
- Homepage:
- Size: 74.2 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - sckott/httpcode - http status code investigation (R)
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 = "#>"
)
```[](https://cloud.r-project.org/web/checks/check_results_httpcode.html)
[](https://github.com/sckott/httpcode/actions/workflows/R-check.yaml)
[](https://codecov.io/gh/sckott/httpcode)
[](https://github.com/metacran/cranlogs.app)
[](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