Simple HTTP client which takes request data from redis
Project description
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 in many reasons. But putting data to local redis (LPUSH) is very quick.
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:
redis2http.py --send GET https://google.com/
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.lpush('http_requests_queue', request)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for redis2http-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a606663c937e66d1b325004390d2e0775e46b1c94ec2580bb6aca3fa3d1de50e |
|
MD5 | f4c06a1e315d0781ceeffc0deff1ade4 |
|
BLAKE2b-256 | 8c5143206c2f55071d393890f7c4db8270425f62c0f884ae93e415a6a2c0792c |