nanoping-api 11.1.0.dev0__py3-none-any.whl
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.
- nanoping_api/__init__.py +18 -0
- nanoping_api/_client.py +154 -0
- nanoping_api/_generated.py +4182 -0
- nanoping_api/_runtime.py +685 -0
- nanoping_api/py.typed +0 -0
- nanoping_api-11.1.0.dev0.dist-info/METADATA +63 -0
- nanoping_api-11.1.0.dev0.dist-info/RECORD +8 -0
- nanoping_api-11.1.0.dev0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: nanoping-api
|
|
3
|
+
Version: 11.1.0.dev0
|
|
4
|
+
Summary: Typed client for the NanoPing REST API
|
|
5
|
+
Project-URL: Homepage, https://nanoping.com
|
|
6
|
+
Project-URL: Documentation, https://docs.nanoping.com/api/reference
|
|
7
|
+
Project-URL: Source, https://github.com/nanoping-labs/nanoping-api-python
|
|
8
|
+
License-Expression: LicenseRef-Proprietary
|
|
9
|
+
Classifier: Framework :: AsyncIO
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Typing :: Typed
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Requires-Dist: httpx>=0.27
|
|
14
|
+
Requires-Dist: websockets>=14
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# NanoPing API for Python
|
|
18
|
+
|
|
19
|
+
A typed client for the REST API of a [NanoPing](https://nanoping.com) node. It
|
|
20
|
+
covers every method of the API, with helpers for flows that take more than one
|
|
21
|
+
call, such as joining a hub. It has a blocking and an asyncio client, and needs
|
|
22
|
+
Python 3.11 or later.
|
|
23
|
+
|
|
24
|
+
This repository is generated from the NanoPing sources on every release, and
|
|
25
|
+
its version matches the NanoPing release it was made from. Changes made here
|
|
26
|
+
are overwritten by the next release.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install nanoping-api
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Use
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from nanoping_api import NanopingClient
|
|
38
|
+
|
|
39
|
+
client = NanopingClient("http://127.0.0.1:10565")
|
|
40
|
+
|
|
41
|
+
local = client.hub_client.get_local_node_id()
|
|
42
|
+
for update in client.hub_client.stream_connection_state():
|
|
43
|
+
print(update.state)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`AsyncNanopingClient` has the same methods for asyncio, and its streams are
|
|
47
|
+
read with `async for`. Requests and responses are dataclasses, and the fields of
|
|
48
|
+
a request are passed as keyword arguments. A failed call raises an `ApiError`,
|
|
49
|
+
whose `code` says why, such as `Code.NOT_FOUND`.
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
`examples` holds the program the
|
|
54
|
+
[HTTP REST guide](https://docs.nanoping.com/api/http-rest) is made from. It
|
|
55
|
+
joins a node to a hub and manages pipelines on both. Start the two nodes as the
|
|
56
|
+
comment in `examples/main.py` describes, then run
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install nanoping-api
|
|
60
|
+
python examples/main.py --client http://127.0.0.1:10565 --server http://127.0.0.1:10566
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The API is documented at https://docs.nanoping.com/api/reference.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
nanoping_api/__init__.py,sha256=SkePsRYuiLX04O8VIIxy4OUlFikAJaYlzcjq5POjw2w,490
|
|
2
|
+
nanoping_api/_client.py,sha256=am-gO3L0WbeMVQOdWYCCj9cvWybX2Th0HVeBoXd-H5w,6251
|
|
3
|
+
nanoping_api/_generated.py,sha256=cIYioDn3W6-HEuUecfUVaevUGGB9buGdyDasdc5Rinc,149605
|
|
4
|
+
nanoping_api/_runtime.py,sha256=j0vvr9FLcU3ATYzPmKn9bKomzLAq4maJu7_Wp7koGwA,24691
|
|
5
|
+
nanoping_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
nanoping_api-11.1.0.dev0.dist-info/METADATA,sha256=sqFLoWASNDpqLQmDgF8ZALeotnOaa-FpdA6ANfn--7E,2075
|
|
7
|
+
nanoping_api-11.1.0.dev0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
8
|
+
nanoping_api-11.1.0.dev0.dist-info/RECORD,,
|