hecho
hecho is a fast and simple HTTP echo server.
An example is running on “http://hecho.bigode.net/”.
It uses Falcon HTTP library and Bjoern WSGI server to serve thousands requests per second using just one CPU Core and approximately 15MB of RAM.
The response is a “prettified” json containing the request.
Simple request/response example:
$ curl --header "Content-Type: application/json" \
--request POST --data '{"user": "john", "pass": "1234"}' \
http://localhost:8000?p=param
{
"headers": {
"ACCEPT": "*/*",
"CONTENT-LENGTH": "32",
"CONTENT-TYPE": "application/json",
"HOST": "localhost:8000",
"USER-AGENT": "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"
},
"json": {
"pass": "1234",
"user": "john"
},
"method": "POST",
"origin": "127.0.0.1",
"params": {
"p": "param"
},
"url": "http://localhost:8000/?p=param"
}
It supports get, post, put, patch and delete methods.
The request data must be JSON or x-www-form-urlencoded (standard simple post).
Notes
Works on Python 2.7 and Python3.4+
Install
Install using pip:
pip install hecho
Usage
Usage: hecho [options] start|stop|restart simple and fast http echo server Options: --version show program's version number and exit -h, --help show this help message and exit -l ADDRESS address to listen (default: localhost) -p PORT application port (default: 8000) --log-path=LOGPATH logfile path (default: ~/.hecho/hecho.log) --pid-path=PIDPATH pidfile path (default: ~/.hecho/hecho.pid) --foreground run in foreground mode (default: disabled) --disable-log disable logging (default: disabled)
Running
Starting the server:
$ hecho start
Verify log, process and tcp listen address:
$ tail ~/.hecho/hecho.log [28/Dec/2018 16:23:10] Starting server... $ ps aux | grep hecho myuser 23648 0.0 1.5 214444 15720 ? S 15:54 0:00 python hecho.py start $ netstat -nlp | grep python tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 23648/python
Simple test:
$ curl localhost:8000
{
"headers": {
"ACCEPT": "*/*",
"HOST": "localhost:8000",
"USER-AGENT": "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"
},
"method": "GET",
"origin": "127.0.0.1",
"params": {},
"url": "http://localhost:8000/"
}
Verify log:
$ tail ~/.hecho/hecho.log [28/Dec/2018 16:23:10] Starting server... [28/Dec/2018 16:24:55] 127.0.0.1 GET http://localhost:8000/ 200 313 curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Stopping the server:
$ hecho stop
Metadata
Release files for hecho 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hecho-0.1.4.tar.gz | 7.1 kB | Without provenance | Details |
Release files / hecho-0.1.4.tar.gz
| Download URL | hecho-0.1.4.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b4257a039117b8d55bec18ccef4a9ee57ff4373d7c6e53468d910732ab2728c
|
|
BLAKE2b-256 checksum How to use checksums |
d7bce547fbcb09f4d433ec5d4b1e4a0b68c8114c28d9597eadbbb95460846c6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15
|
Security for hecho 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.