Request/Response library on top of Redis.
Project description
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
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 Distribution
reds-0.1.9.tar.gz
(3.7 kB
view hashes)
Built Distribution
reds-0.1.9-py3-none-any.whl
(4.7 kB
view hashes)