Skip to main content

Request/Response library on top of Redis.

Project description

Python package Supported Versions PyPI

reds

Request/Response library on top of Redis.

Simple Client/Server example

Client:

from redis import StrictRedis
from reds import Reds


def main():
    key = 'test:queue'
    redis = StrictRedis()
    reds = Reds(redis=redis, key=key)
    for i in range(10):
        task = reds.create_task(task_dict={
            'id': i
        })
        print(task.send())


if __name__ == '__main__':
    main()

Server:

import time
from random import random

from redis import StrictRedis
from reds import Reds


def main():
    key = 'test:queue'
    redis = StrictRedis()
    reds = Reds(redis=redis, key=key)
    for task in reds.listen():
        print(task)
        time.sleep(1)
        task.respond(task_dict={
            'success': random() > 0.5
        })


if __name__ == '__main__':
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reds-0.1.9.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

reds-0.1.9-py3-none-any.whl (4.7 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