Skip to content

technicalanalysis00005-cell/httpstatus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

httpstatus

A fast, zero-dependency HTTP status code lookup CLI for the terminal. Pure Python 3, no external packages.

Stop opening a browser tab to remember what 422 means. Look it up where you already are.

Features

  • Look up any HTTP status code by number (httpstatus 404)
  • Wildcard category lookup (httpstatus 4xx)
  • Full-text search across names and descriptions (httpstatus -s timeout)
  • Filter by category (httpstatus -c client)
  • Color-coded output by category, auto-disabled when piping
  • 60+ status codes including WebDAV (RFC 4918), rate limiting, and the teapot
  • Nearest-code suggestions on miss
  • Single file, no dependencies, runs anywhere Python 3 runs

Install

git clone https://github.com/technicalanalysis00005-cell/httpstatus.git
cd httpstatus
chmod +x httpstatus.py
sudo ln -s "$(pwd)/httpstatus.py" /usr/local/bin/httpstatus

Or just call it directly:

python3 httpstatus.py 404

Usage

Look up a single code

$ httpstatus 418
418 I'm a teapot
  Category: 4xx Client Error
  Defined in 1998 as one of the traditional IETF April Fools' jokes (RFC 2324).

List a whole category with a wildcard

$ httpstatus 5xx
500 Internal Server Error
  Category: 5xx Server Error
  ...
502 Bad Gateway
  ...

Search by keyword

$ httpstatus -s "rate limit"
429 Too Many Requests
  Category: 4xx Client Error
  The user has sent too many requests in a given amount of time. Rate limiting.

List a category

$ httpstatus -c redirection
$ httpstatus -c 3xx        # equivalent

Disable colors

$ httpstatus 404 --no-color

Colors are also auto-disabled when stdout is not a TTY, so piping to grep and friends works cleanly.

Categories

Range Category Color
1xx Informational cyan
2xx Success green
3xx Redirection yellow
4xx Client Error red
5xx Server Error magenta

Exit codes

  • 0 — code or query found
  • 1 — not found, invalid input, or no arguments given

Useful in scripts:

if httpstatus "$code" >/dev/null 2>&1; then
    echo "Known status code"
fi

Why

curl httpstat.us/418 is fun, but offline tools are faster. This is one Python file you can drop on any box you SSH into.

License

MIT

About

Fast zero-dependency HTTP status code lookup CLI for the terminal

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages