Skip to main content

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


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

redis2http-0.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page