redis2http
Redis2http takes request data from redis and performs HTTP request. Mostly used to implement web-hook calls
Why not requests.get/requests.post ?
Most likely you want main program to run fast and spend very short time on calling hook. HTTP requests are not good for it - it may fail or be slow for many reasons. On other hand, LPUSH operation with local redis is always very quick and very reliable.
redis2http is good if a) You do not need to wait for HTTP request completion b) You do not need to get any reply from request
Install
pip3 install redis2http
If you want to start on boot (as root or sudo):
cp /usr/local/redis2http/redis2http.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable redis2http
systemctl start redis2http
Usage for CLI
CLI is not main purpose for redis2http, but it's good for testing. Examples:
To start as service in foreground (for debugging), just run redis2http.py (not options required).
To send request via redis (for debugging):
redis2http.py --send GET https://google.com/
After this (in less then second), you can see result in redis2http service output. If redis2http runs as systemd service, then sudo journalctl -u redis2http.
Usage from Python or from whatever (via redis)
Put JSON-encoded data structure to http_requests_queue list (or use -q for other key name). Python example:
data = {
'method': 'GET',
'url': 'https://example.com/hook',
'payload': None
}
request = json.dumps(data)
redis_connection.sadd('http_requests_queue', request)
Set vs List
redis2http may use queue as redis object of type set or type list. You may specify type as --type CLI option. Default is set.
If you will use set and submit same data twice, only one HTTP request will be performed. If you will use list, both requests will be performed.
Metadata
Release files for redis2http 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| redis2http-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / redis2http-0.0.2-py3-none-any.whl
| Download URL | redis2http-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e89db2d06178db5d6b17bf5b765bf7cf0aef1cf38288a73aeca9d731a6e5ce9
|
|
BLAKE2b-256 checksum How to use checksums |
af535708b90c84965503a85735af2bcd0e7fbd2440847a0480b1825390284f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2
|
Security for redis2http 0.0.2
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.