Python function to return one or multiple responses to a NATS request as soon as possible.
Project description
nats_request_asap
Python function to return one or multiple responses to a NATS request as soon as possible.
Installation
pip install nats_request_asap
Usage
One response
Return a single NATS Msg
.
>>> import nats_request_asap
>>> nats_request_asap.req_asap(z, b'{"nodes": ["af9c"]}', timeout=5)
<Msg: subject='_INBOX.tdSY0nNLoa9bYPqw9moCwC' reply='' data='{"initial_...'>
Multiple responses
Return a list of NATS Msg
s.
>>> nats_request_asap.req_asap(z, b'{"nodes": "all"}', expected=3, timeout=5)
[<Msg: subject='_INBOX.tdSY0nNLoa9bmNqw9moCwC' reply='' data='{"error": ...'>,
<Msg: subject='_INBOX.tdSY0nNLoa9bmNqw9moCwC' reply='' data='{"initial_...'>,
<Msg: subject='_INBOX.tdSY0nNLoa9bmNqw9moCwC' reply='' data='{"initial_...'>]
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
Built Distribution
Close
Hashes for nats_request_asap-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 834f4fc618f661ac808e93ed0fc52a65923574e5e7a7b64124a871984dc729ae |
|
MD5 | 128b9a48bf124c734918f85552c75f7c |
|
BLAKE2b-256 | b5bb16e943c60562cb535c8b6d1df4817c9c638574ea07a5a6f458ce53067c40 |