iricity-sdk 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.
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 IRICITY LEADERSHIP PRIVATE LIMITED (OPC)
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
@@ -0,0 +1,3 @@
1
+ Copyright 2026 IRICITY LEADERSHIP PRIVATE LIMITED (OPC)
2
+
3
+ This package is distributed under the Apache License, Version 2.0.
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: iricity-sdk
3
+ Version: 0.1.0
4
+ Summary: Thin Python client for Iricity machine-payment flows.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://iricity.com/developer.html
7
+ Project-URL: Documentation, https://iricity.com/api-docs.html
8
+ Project-URL: Repository, https://github.com/parthod0x/iricity-webapp
9
+ Keywords: iricity,sdk,payments,ai
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
18
+ Dynamic: license-file
19
+
20
+ # iricity-sdk
21
+
22
+ Thin Python client for:
23
+ - catalog
24
+ - quote
25
+ - execute
26
+ - wait
27
+ - provenance-aware settled responses
28
+
29
+ ## Install from repo
30
+
31
+ ```bash
32
+ pip install ./apps/sdk-python
33
+ ```
34
+
35
+ ## Publish-ready install target
36
+
37
+ ```bash
38
+ pip install iricity-sdk
39
+ ```
40
+
41
+ ## Example
42
+
43
+ ```python
44
+ from iricity_sdk import IricityClient
45
+
46
+ client = IricityClient(api_key="your_api_key")
47
+
48
+ result = client.run(
49
+ "analysis-job",
50
+ {
51
+ "primary": {
52
+ "documentText": "Paste your source text here...",
53
+ "goal": "Summarize key points and actions",
54
+ "audience": "Operations leadership",
55
+ },
56
+ "options": {
57
+ "outputMode": "brief",
58
+ "urgency": "normal",
59
+ "includeArtifacts": False,
60
+ },
61
+ },
62
+ wait=True,
63
+ )
64
+
65
+ print(result)
66
+ ```
@@ -0,0 +1,47 @@
1
+ # iricity-sdk
2
+
3
+ Thin Python client for:
4
+ - catalog
5
+ - quote
6
+ - execute
7
+ - wait
8
+ - provenance-aware settled responses
9
+
10
+ ## Install from repo
11
+
12
+ ```bash
13
+ pip install ./apps/sdk-python
14
+ ```
15
+
16
+ ## Publish-ready install target
17
+
18
+ ```bash
19
+ pip install iricity-sdk
20
+ ```
21
+
22
+ ## Example
23
+
24
+ ```python
25
+ from iricity_sdk import IricityClient
26
+
27
+ client = IricityClient(api_key="your_api_key")
28
+
29
+ result = client.run(
30
+ "analysis-job",
31
+ {
32
+ "primary": {
33
+ "documentText": "Paste your source text here...",
34
+ "goal": "Summarize key points and actions",
35
+ "audience": "Operations leadership",
36
+ },
37
+ "options": {
38
+ "outputMode": "brief",
39
+ "urgency": "normal",
40
+ "includeArtifacts": False,
41
+ },
42
+ },
43
+ wait=True,
44
+ )
45
+
46
+ print(result)
47
+ ```
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iricity-sdk"
7
+ version = "0.1.0"
8
+ description = "Thin Python client for Iricity machine-payment flows."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE", "NOTICE"]
12
+ keywords = ["iricity", "sdk", "payments", "ai"]
13
+ requires-python = ">=3.10"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://iricity.com/developer.html"
23
+ Documentation = "https://iricity.com/api-docs.html"
24
+ Repository = "https://github.com/parthod0x/iricity-webapp"
25
+
26
+ [tool.setuptools.packages.find]
27
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .client import IricityClient, IricitySdkError
2
+
3
+ __all__ = ["IricityClient", "IricitySdkError"]
@@ -0,0 +1,104 @@
1
+ import json
2
+ import time
3
+ import urllib.error
4
+ import urllib.request
5
+
6
+
7
+ DEFAULT_API_BASE = "https://iricity-webapp-api.onrender.com"
8
+ TERMINAL_STATUSES = {"completed", "failed", "canceled", "timed_out"}
9
+
10
+
11
+ class IricitySdkError(RuntimeError):
12
+ def __init__(self, message, status=None, payload=None):
13
+ super().__init__(message)
14
+ self.status = status
15
+ self.payload = payload
16
+
17
+
18
+ class IricityClient:
19
+ def __init__(self, api_key, api_base=DEFAULT_API_BASE, poll_interval_seconds=1.5, wait_timeout_seconds=180):
20
+ if not api_key:
21
+ raise IricitySdkError("Missing api_key.")
22
+ self.api_key = api_key
23
+ self.api_base = api_base.rstrip("/")
24
+ self.poll_interval_seconds = poll_interval_seconds
25
+ self.wait_timeout_seconds = wait_timeout_seconds
26
+
27
+ def _request_json(self, path, method="GET", headers=None, body=None):
28
+ request = urllib.request.Request(f"{self.api_base}{path}", method=method)
29
+ request.add_header("Authorization", f"Bearer {self.api_key}")
30
+ request.add_header("Content-Type", "application/json")
31
+ for key, value in (headers or {}).items():
32
+ request.add_header(key, value)
33
+
34
+ payload = None if body is None else json.dumps(body).encode("utf-8")
35
+ try:
36
+ with urllib.request.urlopen(request, data=payload) as response:
37
+ text = response.read().decode("utf-8")
38
+ return json.loads(text) if text else {}
39
+ except urllib.error.HTTPError as exc:
40
+ text = exc.read().decode("utf-8") if exc.fp else ""
41
+ payload = json.loads(text) if text else {}
42
+ message = payload.get("error") if isinstance(payload, dict) else None
43
+ raise IricitySdkError(message or f"Request failed with {exc.code}", exc.code, payload) from exc
44
+
45
+ def catalog(self):
46
+ return self._request_json("/v1/internet-payments/catalog")
47
+
48
+ def quote(self, feature_id, input_payload):
49
+ return self._request_json(
50
+ "/v1/internet-payments/quotes/execution",
51
+ method="POST",
52
+ body={"featureId": feature_id, "input": input_payload},
53
+ )
54
+
55
+ def execute(self, feature_id, input_payload, idempotency_key=None, allow_fallback=True, receipt_token=None):
56
+ receipt = receipt_token or self.quote(feature_id, input_payload).get("paymentRequired", {}).get("receiptToken")
57
+ if not receipt:
58
+ raise IricitySdkError("Quote did not return a payment receipt.")
59
+
60
+ return self._request_json(
61
+ "/v1/internet-payments/execute",
62
+ method="POST",
63
+ headers={"x-iricity-payment-receipt": receipt},
64
+ body={
65
+ "featureId": feature_id,
66
+ "input": input_payload,
67
+ "idempotencyKey": idempotency_key or f"sdk-py-{int(time.time())}",
68
+ "allowFallback": allow_fallback,
69
+ },
70
+ )
71
+
72
+ def get_job(self, job_id):
73
+ data = self._request_json(f"/v1/execution/jobs/{job_id}")
74
+ return data.get("job")
75
+
76
+ def wait_for_job(self, job_id, timeout_seconds=None, poll_interval_seconds=None):
77
+ timeout_seconds = timeout_seconds or self.wait_timeout_seconds
78
+ poll_interval_seconds = poll_interval_seconds or self.poll_interval_seconds
79
+ started = time.time()
80
+
81
+ while time.time() - started <= timeout_seconds:
82
+ job = self.get_job(job_id)
83
+ if job and job.get("status") in TERMINAL_STATUSES:
84
+ return job
85
+ time.sleep(poll_interval_seconds)
86
+
87
+ raise IricitySdkError(f"Timed out waiting for job {job_id}.")
88
+
89
+ def run(self, feature_id, input_payload, idempotency_key=None, wait=False, allow_fallback=True):
90
+ quote = self.quote(feature_id, input_payload)
91
+ execute = self.execute(
92
+ feature_id,
93
+ input_payload,
94
+ idempotency_key=idempotency_key,
95
+ allow_fallback=allow_fallback,
96
+ receipt_token=quote.get("paymentRequired", {}).get("receiptToken"),
97
+ )
98
+ job_id = (execute.get("settled") or {}).get("job", {}).get("id") or (execute.get("execute") or {}).get("id")
99
+ settled = (
100
+ {"job": self.wait_for_job(job_id), "initial": execute.get("settled")}
101
+ if wait and job_id
102
+ else execute.get("settled")
103
+ )
104
+ return {"quote": quote.get("quote"), "execute": execute.get("execute"), "settled": settled}
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: iricity-sdk
3
+ Version: 0.1.0
4
+ Summary: Thin Python client for Iricity machine-payment flows.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://iricity.com/developer.html
7
+ Project-URL: Documentation, https://iricity.com/api-docs.html
8
+ Project-URL: Repository, https://github.com/parthod0x/iricity-webapp
9
+ Keywords: iricity,sdk,payments,ai
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
18
+ Dynamic: license-file
19
+
20
+ # iricity-sdk
21
+
22
+ Thin Python client for:
23
+ - catalog
24
+ - quote
25
+ - execute
26
+ - wait
27
+ - provenance-aware settled responses
28
+
29
+ ## Install from repo
30
+
31
+ ```bash
32
+ pip install ./apps/sdk-python
33
+ ```
34
+
35
+ ## Publish-ready install target
36
+
37
+ ```bash
38
+ pip install iricity-sdk
39
+ ```
40
+
41
+ ## Example
42
+
43
+ ```python
44
+ from iricity_sdk import IricityClient
45
+
46
+ client = IricityClient(api_key="your_api_key")
47
+
48
+ result = client.run(
49
+ "analysis-job",
50
+ {
51
+ "primary": {
52
+ "documentText": "Paste your source text here...",
53
+ "goal": "Summarize key points and actions",
54
+ "audience": "Operations leadership",
55
+ },
56
+ "options": {
57
+ "outputMode": "brief",
58
+ "urgency": "normal",
59
+ "includeArtifacts": False,
60
+ },
61
+ },
62
+ wait=True,
63
+ )
64
+
65
+ print(result)
66
+ ```
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ NOTICE
3
+ README.md
4
+ pyproject.toml
5
+ src/iricity_sdk/__init__.py
6
+ src/iricity_sdk/client.py
7
+ src/iricity_sdk.egg-info/PKG-INFO
8
+ src/iricity_sdk.egg-info/SOURCES.txt
9
+ src/iricity_sdk.egg-info/dependency_links.txt
10
+ src/iricity_sdk.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ iricity_sdk