nuyss-client 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nuyss_client-0.1.0/PKG-INFO +31 -0
- nuyss_client-0.1.0/README.md +22 -0
- nuyss_client-0.1.0/nuyss_client/__init__.py +1272 -0
- nuyss_client-0.1.0/nuyss_client.egg-info/PKG-INFO +31 -0
- nuyss_client-0.1.0/nuyss_client.egg-info/SOURCES.txt +7 -0
- nuyss_client-0.1.0/nuyss_client.egg-info/dependency_links.txt +1 -0
- nuyss_client-0.1.0/nuyss_client.egg-info/top_level.txt +1 -0
- nuyss_client-0.1.0/pyproject.toml +18 -0
- nuyss_client-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nuyss-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Client for the Nuyss API: start runs, send events and wait for results.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Repository, https://github.com/nuyss-io/nuyss
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# nuyss-client
|
|
11
|
+
|
|
12
|
+
Client for the API of a Nuyss installation (`nuyss serve`). It is not a workflow SDK: the workflow is the document. This is how an application starts runs, sends events and waits for results.
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import os
|
|
16
|
+
from nuyss_client import NuyssClient, NuyssError
|
|
17
|
+
|
|
18
|
+
nuyss = NuyssClient("https://nuyss.example.com", token=os.environ["NUYSS_TOKEN"])
|
|
19
|
+
|
|
20
|
+
# Start and wait (with a key, repeating the call does not start another run).
|
|
21
|
+
r = nuyss.run("orders", "order", {"order": "PO-42", "amount": 120}, idempotency_key="order-42")
|
|
22
|
+
if r["status"] == "completed":
|
|
23
|
+
print(r["output"])
|
|
24
|
+
|
|
25
|
+
# An event for the runs that wait for it.
|
|
26
|
+
nuyss.send_event("orders", {"id": "payment-42", "name": "payment.received", "data": {"amount": 120}})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
API errors arrive as `NuyssError`, with `status`, `code` and `details`. An answer that isn't from Nuyss (a proxy's HTML page) is also a `NuyssError`: `http_<status>` (such as `http_502`) with the start of the body as the message, or `invalid_response` for a successful answer that isn't JSON. Each request gives up after `timeout` seconds (6 minutes by default, an argument of `NuyssClient`) and raises the builtin `TimeoutError`, also when connecting; it isn't a `NuyssError`.
|
|
30
|
+
|
|
31
|
+
Generated from `docs/api/openapi.json` with `cargo xtask clients`: do not edit `nuyss_client/__init__.py` by hand. No dependencies (standard library only; Python 3.9 or later).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# nuyss-client
|
|
2
|
+
|
|
3
|
+
Client for the API of a Nuyss installation (`nuyss serve`). It is not a workflow SDK: the workflow is the document. This is how an application starts runs, sends events and waits for results.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import os
|
|
7
|
+
from nuyss_client import NuyssClient, NuyssError
|
|
8
|
+
|
|
9
|
+
nuyss = NuyssClient("https://nuyss.example.com", token=os.environ["NUYSS_TOKEN"])
|
|
10
|
+
|
|
11
|
+
# Start and wait (with a key, repeating the call does not start another run).
|
|
12
|
+
r = nuyss.run("orders", "order", {"order": "PO-42", "amount": 120}, idempotency_key="order-42")
|
|
13
|
+
if r["status"] == "completed":
|
|
14
|
+
print(r["output"])
|
|
15
|
+
|
|
16
|
+
# An event for the runs that wait for it.
|
|
17
|
+
nuyss.send_event("orders", {"id": "payment-42", "name": "payment.received", "data": {"amount": 120}})
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
API errors arrive as `NuyssError`, with `status`, `code` and `details`. An answer that isn't from Nuyss (a proxy's HTML page) is also a `NuyssError`: `http_<status>` (such as `http_502`) with the start of the body as the message, or `invalid_response` for a successful answer that isn't JSON. Each request gives up after `timeout` seconds (6 minutes by default, an argument of `NuyssClient`) and raises the builtin `TimeoutError`, also when connecting; it isn't a `NuyssError`.
|
|
21
|
+
|
|
22
|
+
Generated from `docs/api/openapi.json` with `cargo xtask clients`: do not edit `nuyss_client/__init__.py` by hand. No dependencies (standard library only; Python 3.9 or later).
|