Skip to main content

Python function to return one or multiple responses to a NATS request as soon as possible.

Project description

nats_request_asap

Documentation Status

Python function to return one or multiple responses to a NATS request as soon as possible.

Documentation

nats-request-asap.readthedocs.io

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 Msgs.

>>> 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_...'>]

License

This project is under the MIT License. See LICENSE.txt.

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

nats-request-asap-0.2.2.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

nats_request_asap-0.2.2-py3-none-any.whl (3.8 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