olonghon-sdk 0.2.0a1__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.
@@ -0,0 +1,37 @@
1
+ """Synchronous Olonghon REST client. Python 3.9+, standard library only."""
2
+ import json
3
+ from urllib.error import HTTPError
4
+ from urllib.parse import quote
5
+ from urllib.request import Request, urlopen
6
+
7
+
8
+ class OlonghonError(Exception):
9
+ def __init__(self, status, message):
10
+ super().__init__(message)
11
+ self.status = status
12
+
13
+
14
+ class Olonghon:
15
+ def __init__(self, base_url="http://127.0.0.1:8787", timeout=10):
16
+ self.base_url = base_url.rstrip("/")
17
+ self.timeout = timeout
18
+
19
+ def _request(self, method, path, body=None):
20
+ data = json.dumps(body).encode() if body is not None else None
21
+ request = Request(self.base_url + path, data=data, method=method,
22
+ headers={"Content-Type": "application/json", "Accept": "application/json"})
23
+ try:
24
+ with urlopen(request, timeout=self.timeout) as response:
25
+ return json.load(response)
26
+ except HTTPError as err:
27
+ message = err.read().decode(errors="replace")
28
+ raise OlonghonError(err.code, message.strip()) from err
29
+
30
+ def submit(self, operation_id, action, inputs):
31
+ return self._request("POST", "/v1/operations", {"id": operation_id, "action": action, "input": inputs})
32
+
33
+ def get(self, operation_id):
34
+ return self._request("GET", "/v1/operations/" + quote(operation_id, safe=""))
35
+
36
+ def reconcile(self, operation_id):
37
+ return self._request("POST", "/v1/operations/" + quote(operation_id, safe="") + "/reconcile")
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.4
2
+ Name: olonghon-sdk
3
+ Version: 0.2.0a1
4
+ Summary: Python client for the Olonghon developer preview
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 Olonghon contributors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Project-URL: Repository, https://github.com/ponickkhan/olonghon
28
+ Requires-Python: >=3.9
29
+ License-File: LICENSE
30
+ Dynamic: license-file
@@ -0,0 +1,6 @@
1
+ olonghon_sdk/__init__.py,sha256=3uepBd95r9X8qYsiwZLRpmKS63upfROhrCjIEVPYlFw,1508
2
+ olonghon_sdk-0.2.0a1.dist-info/licenses/LICENSE,sha256=l-4agBlx2afytlWZs2x1Dz9fvyk4YT2QDbHTYu8vwnk,1078
3
+ olonghon_sdk-0.2.0a1.dist-info/METADATA,sha256=9CmWBRDDgnbouK44_KbtrTxY8rrgfwS9hQBxqhBQwKE,1503
4
+ olonghon_sdk-0.2.0a1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ olonghon_sdk-0.2.0a1.dist-info/top_level.txt,sha256=kwUzcrGKTEejwFfmjoszdlBpf-_9Tiwouzu8JyncMJ4,13
6
+ olonghon_sdk-0.2.0a1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Olonghon contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ olonghon_sdk