auros-protocol 1.0.0__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.
- auros/__init__.py +6 -0
- auros/client.py +136 -0
- auros/py.typed +0 -0
- auros_protocol-1.0.0.dist-info/METADATA +118 -0
- auros_protocol-1.0.0.dist-info/RECORD +6 -0
- auros_protocol-1.0.0.dist-info/WHEEL +4 -0
auros/__init__.py
ADDED
auros/client.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""AUROS Protocol HTTP client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
DEFAULT_BASE_URL = "https://getauros.com"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AurosProtocolError(Exception):
|
|
13
|
+
def __init__(self, code: str, message: str, status: int) -> None:
|
|
14
|
+
super().__init__(message)
|
|
15
|
+
self.code = code
|
|
16
|
+
self.message = message
|
|
17
|
+
self.status = status
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class AurosProtocol:
|
|
21
|
+
"""Typed client for the AUROS Protocol REST API."""
|
|
22
|
+
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
api_key: str,
|
|
26
|
+
*,
|
|
27
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
28
|
+
client: httpx.Client | None = None,
|
|
29
|
+
) -> None:
|
|
30
|
+
if not api_key or not api_key.strip():
|
|
31
|
+
raise ValueError("api_key is required")
|
|
32
|
+
self._api_key = api_key.strip()
|
|
33
|
+
self._base_url = base_url.rstrip("/")
|
|
34
|
+
self._client = client or httpx.Client(timeout=30.0)
|
|
35
|
+
self._owns_client = client is None
|
|
36
|
+
|
|
37
|
+
def close(self) -> None:
|
|
38
|
+
if self._owns_client:
|
|
39
|
+
self._client.close()
|
|
40
|
+
|
|
41
|
+
def __enter__(self) -> AurosProtocol:
|
|
42
|
+
return self
|
|
43
|
+
|
|
44
|
+
def __exit__(self, *args: object) -> None:
|
|
45
|
+
self.close()
|
|
46
|
+
|
|
47
|
+
def score(self, **body: Any) -> dict[str, Any]:
|
|
48
|
+
return self._post("/api/v1/score", body)
|
|
49
|
+
|
|
50
|
+
def score_batch(self, **body: Any) -> dict[str, Any]:
|
|
51
|
+
return self._post("/api/v1/score/batch", body)
|
|
52
|
+
|
|
53
|
+
def score_history(self, score_id: str) -> dict[str, Any]:
|
|
54
|
+
return self._request("GET", f"/api/v1/score/{score_id}/history")
|
|
55
|
+
|
|
56
|
+
def products(self, **query: Any) -> dict[str, Any]:
|
|
57
|
+
return self._get("/api/v1/products", query)
|
|
58
|
+
|
|
59
|
+
def jurisdictions(self, **query: Any) -> dict[str, Any]:
|
|
60
|
+
return self._get("/api/v1/jurisdictions", query)
|
|
61
|
+
|
|
62
|
+
def checklist(self, **body: Any) -> dict[str, Any]:
|
|
63
|
+
return self._post("/api/v1/checklist", body)
|
|
64
|
+
|
|
65
|
+
def compare(self, **body: Any) -> dict[str, Any]:
|
|
66
|
+
return self._post("/api/v1/compare", body)
|
|
67
|
+
|
|
68
|
+
def status(self) -> dict[str, Any]:
|
|
69
|
+
return self._request("GET", "/api/v1/status", auth=False)
|
|
70
|
+
|
|
71
|
+
def monitor(self, **body: Any) -> dict[str, Any]:
|
|
72
|
+
return self._post("/api/v1/monitor", body)
|
|
73
|
+
|
|
74
|
+
def get_monitor(self, monitor_id: str) -> dict[str, Any]:
|
|
75
|
+
return self._request("GET", f"/api/v1/monitor/{monitor_id}")
|
|
76
|
+
|
|
77
|
+
def delete_monitor(self, monitor_id: str) -> dict[str, Any]:
|
|
78
|
+
return self._request("DELETE", f"/api/v1/monitor/{monitor_id}")
|
|
79
|
+
|
|
80
|
+
def dossier(self, **body: Any) -> dict[str, Any]:
|
|
81
|
+
return self._post("/api/v1/dossier", body)
|
|
82
|
+
|
|
83
|
+
def register_webhook(self, **body: Any) -> dict[str, Any]:
|
|
84
|
+
return self._post("/api/v1/webhooks", body)
|
|
85
|
+
|
|
86
|
+
def webhooks(self) -> dict[str, Any]:
|
|
87
|
+
return self._request("GET", "/api/v1/webhooks")
|
|
88
|
+
|
|
89
|
+
def delete_webhook(self, webhook_id: str) -> dict[str, Any]:
|
|
90
|
+
return self._request("DELETE", f"/api/v1/webhooks/{webhook_id}")
|
|
91
|
+
|
|
92
|
+
def create_key(self, email: str) -> dict[str, Any]:
|
|
93
|
+
return self._request("POST", "/api/v1/keys", json={"email": email}, auth=False)
|
|
94
|
+
|
|
95
|
+
def _get(self, path: str, params: dict[str, Any]) -> dict[str, Any]:
|
|
96
|
+
filtered = {k: v for k, v in params.items() if v is not None}
|
|
97
|
+
return self._request("GET", path, params=filtered)
|
|
98
|
+
|
|
99
|
+
def _post(self, path: str, body: dict[str, Any]) -> dict[str, Any]:
|
|
100
|
+
filtered = {k: v for k, v in body.items() if v is not None}
|
|
101
|
+
return self._request("POST", path, json=filtered)
|
|
102
|
+
|
|
103
|
+
def _request(
|
|
104
|
+
self,
|
|
105
|
+
method: str,
|
|
106
|
+
path: str,
|
|
107
|
+
*,
|
|
108
|
+
json: dict[str, Any] | None = None,
|
|
109
|
+
params: dict[str, Any] | None = None,
|
|
110
|
+
auth: bool = True,
|
|
111
|
+
) -> dict[str, Any]:
|
|
112
|
+
headers: dict[str, str] = {
|
|
113
|
+
"Accept": "application/json",
|
|
114
|
+
"X-AUROS-Protocol-Version": "1.0",
|
|
115
|
+
}
|
|
116
|
+
if json is not None:
|
|
117
|
+
headers["Content-Type"] = "application/json"
|
|
118
|
+
if auth:
|
|
119
|
+
headers["Authorization"] = f"Bearer {self._api_key}"
|
|
120
|
+
|
|
121
|
+
response = self._client.request(
|
|
122
|
+
method,
|
|
123
|
+
f"{self._base_url}{path}",
|
|
124
|
+
headers=headers,
|
|
125
|
+
json=json,
|
|
126
|
+
params=params,
|
|
127
|
+
)
|
|
128
|
+
data = response.json()
|
|
129
|
+
if not response.is_success:
|
|
130
|
+
err = data.get("error", {}) if isinstance(data, dict) else {}
|
|
131
|
+
raise AurosProtocolError(
|
|
132
|
+
err.get("code", "unknown_error"),
|
|
133
|
+
err.get("message", "Request failed"),
|
|
134
|
+
response.status_code,
|
|
135
|
+
)
|
|
136
|
+
return data
|
auros/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auros-protocol
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK for the AUROS Protocol — RWA intelligence API
|
|
5
|
+
Project-URL: Homepage, https://getauros.com/developers
|
|
6
|
+
Project-URL: Documentation, https://getauros.com/developers/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/getauros/auros
|
|
8
|
+
Author-email: AUROS <contact@getauros.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: api,auros,mica,rwa,tokenization
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: httpx>=0.27
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# auros-protocol (Python)
|
|
24
|
+
|
|
25
|
+
Official Python SDK for the [AUROS Protocol](https://getauros.com/developers).
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install auros-protocol
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or from source:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd packages/auros-protocol-python
|
|
37
|
+
pip install -e .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quickstart
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from auros import AurosProtocol
|
|
44
|
+
|
|
45
|
+
client = AurosProtocol(api_key="auros_pk_test_demo")
|
|
46
|
+
|
|
47
|
+
result = client.score(
|
|
48
|
+
description="Retail warehouse Luxembourg €2.5M SPV professional investors"
|
|
49
|
+
)
|
|
50
|
+
print(result["score"], result["grade"], result["mica_classification"])
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Methods
|
|
54
|
+
|
|
55
|
+
| Method | Endpoint | Auth |
|
|
56
|
+
|--------|----------|------|
|
|
57
|
+
| `score(**fields)` | `POST /api/v1/score` | Bearer |
|
|
58
|
+
| `score_batch(**body)` | `POST /api/v1/score/batch` | Bearer |
|
|
59
|
+
| `products(**query)` | `GET /api/v1/products` | Bearer |
|
|
60
|
+
| `jurisdictions(**query)` | `GET /api/v1/jurisdictions` | Bearer |
|
|
61
|
+
| `checklist(**body)` | `POST /api/v1/checklist` | Bearer |
|
|
62
|
+
| `compare(**body)` | `POST /api/v1/compare` | Bearer |
|
|
63
|
+
| `status()` | `GET /api/v1/status` | None |
|
|
64
|
+
| `create_key(email)` | `POST /api/v1/keys` | None |
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
# Catalog
|
|
70
|
+
bonds = client.products(category="bonds", yield_min=4, limit=10)
|
|
71
|
+
|
|
72
|
+
# Jurisdictions
|
|
73
|
+
ranking = client.jurisdictions(
|
|
74
|
+
asset_type="real_estate",
|
|
75
|
+
investor_type="professional",
|
|
76
|
+
timeline_months=6,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Checklist
|
|
80
|
+
items = client.checklist(
|
|
81
|
+
asset_type="real_estate",
|
|
82
|
+
jurisdiction="luxembourg",
|
|
83
|
+
structure="spv",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Compare RWA products
|
|
87
|
+
comparison = client.compare(category="bonds", yield_min=4, limit=3)
|
|
88
|
+
|
|
89
|
+
# API health (no auth)
|
|
90
|
+
health = client.status()
|
|
91
|
+
print(health["status"], health["version"])
|
|
92
|
+
|
|
93
|
+
# Free API key
|
|
94
|
+
key_resp = client.create_key("you@company.com")
|
|
95
|
+
print(key_resp["api_key"])
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Context manager
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
with AurosProtocol(api_key="auros_pk_test_demo") as client:
|
|
102
|
+
print(client.score(description="..."))
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Disclaimer
|
|
106
|
+
|
|
107
|
+
Indicative intelligence only — not legal, tax, or investment advice.
|
|
108
|
+
|
|
109
|
+
## Publish (maintainers)
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd packages/auros-protocol-python
|
|
113
|
+
python -m pip install --upgrade build twine
|
|
114
|
+
python -m build
|
|
115
|
+
python -m twine upload dist/*
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Set `TWINE_USERNAME=__token__` and `TWINE_PASSWORD=pypi-<your-api-token>` before upload.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
auros/__init__.py,sha256=hiDLdd2ciDa7Gj9WDnUkCUqbNEAIzt1cGJTpzmnOcdE,172
|
|
2
|
+
auros/client.py,sha256=5IJyYvDr-EdQ2w5xcPFLCh-8Aso9ua8Grac3Nh-rnQ4,4634
|
|
3
|
+
auros/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
auros_protocol-1.0.0.dist-info/METADATA,sha256=38kU1TqBs8OrlgN5f7B60F70PJGg5Qv3PA0nXDho-x4,3061
|
|
5
|
+
auros_protocol-1.0.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
6
|
+
auros_protocol-1.0.0.dist-info/RECORD,,
|