curl statistics made simple
Project description
httpstat
httpstat visualizes curl(1) statistics in a way of beauty and clarity.
It is a single file🌟 Python script that has no dependency👏 and is compatible with Python 3🍻.
Installation
There are three ways to get httpstat:
-
Download the script directly:
wget https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py -
Through pip:
pip install httpstat -
Through homebrew (macOS only):
brew install httpstat
For Windows users, @davecheney's Go version is suggested. → download link
Usage
Simply:
python httpstat.py httpbin.org/get
If installed through pip or brew, you can use httpstat as a command:
httpstat httpbin.org/get
cURL Options
Because httpstat is a wrapper of cURL, you can pass any cURL supported option after the url (except for -w, -D, -o, -s, -S which are already used by httpstat):
httpstat httpbin.org/post -X POST --data-urlencode "a=b" -v
Environment Variables
httpstat has a bunch of environment variables to control its behavior.
Here are some usage demos, you can also run httpstat --help to see full explanation.
-
HTTPSTAT_SHOW_BODYSet to
trueto show response body in the output, note that body length is limited to 1023 bytes, will be truncated if exceeds. Default isfalse. -
HTTPSTAT_SHOW_IPBy default httpstat shows remote and local IP/port address. Set to
falseto disable this feature. Default istrue. -
HTTPSTAT_SHOW_SPEEDSet to
trueto show download and upload speed. Default isfalse.HTTPSTAT_SHOW_SPEED=true httpstat http://cachefly.cachefly.net/10mb.test ... speed_download: 3193.3 KiB/s, speed_upload: 0.0 KiB/s
-
HTTPSTAT_SAVE_BODYBy default httpstat stores body in a tmp file, set to
falseto disable this feature. Default istrue -
HTTPSTAT_CURL_BINIndicate the cURL bin path to use. Default is
curlfrom current shell $PATH.This exampe uses brew installed cURL to make HTTP2 request:
HTTPSTAT_CURL_BIN=/usr/local/Cellar/curl/7.50.3/bin/curl httpstat https://http2.akamai.com/ --http2 HTTP/2 200 ...
cURL must be compiled with nghttp2 to enable http2 feature (#12).
-
HTTPSTAT_METRICS_ONLYIf set to
true, httpstat will only output metrics in json format, this is useful if you want to parse the data instead of reading it. -
HTTPSTAT_DEBUGSet to
trueto see debugging logs. Default isfalse
For convenience, you can export these environments in your .zshrc or .bashrc,
example:
export HTTPSTAT_SHOW_IP=false
export HTTPSTAT_SHOW_SPEED=true
export HTTPSTAT_SAVE_BODY=false
Buy me a coffee
Related Projects
Here are some implementations in various languages:
-
This is the Go alternative of httpstat, it's written in pure Go and relies no external programs. Choose it if you like solid binary executions (actually I do).
-
Go (library): tcnksm/go-httpstat
Other than being a cli tool, this project is used as library to help debugging latency of HTTP requests in Go code, very thoughtful and useful, see more in this article
-
Bash: b4b4r07/httpstat
This is what exactly I want to do at the very beginning, but gave up due to not confident in my bash skill, good job!
-
Node: yosuke-furukawa/httpstat
b4b4r07 mentioned this in his article, could be used as a HTTP client also.
-
The PHP implementation by @talhasch
Some code blocks in httpstat are copied from other projects of mine, have a look:
-
reorx/python-terminal-color Drop-in single file library for printing terminal color.
-
reorx/getenv Environment variable definition with type.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file httpstat-1.3.2.tar.gz.
File metadata
- Download URL: httpstat-1.3.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a185fbbd0b55aa213a8a72101b0e4ddb2f104678d1bf81fb351985d5fd49d70
|
|
| MD5 |
7dc0b11a6af0bcacc591903d2a315ca3
|
|
| BLAKE2b-256 |
c456117333e5f43b001656865fe891ceed8f483711dd6db965e4b6adf4caf322
|
File details
Details for the file httpstat-1.3.2-py3-none-any.whl.
File metadata
- Download URL: httpstat-1.3.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6cebfc3f14a6be898782194ba7b6b87f9c06a2b4a3cb91f9c966467ab7f6f75
|
|
| MD5 |
0a9b8528f9951e07c2a8e81769278706
|
|
| BLAKE2b-256 |
00f29e28e80e37fe0efbf462316ac3b4a3c885e5c38ccb0476ce976c988f58f2
|