aranova-tracking 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.
- aranova_tracking-0.1.0/LICENSE +21 -0
- aranova_tracking-0.1.0/PKG-INFO +110 -0
- aranova_tracking-0.1.0/README.md +90 -0
- aranova_tracking-0.1.0/pyproject.toml +79 -0
- aranova_tracking-0.1.0/src/aranova_tracking/__init__.py +34 -0
- aranova_tracking-0.1.0/src/aranova_tracking/_endpoints.py +1584 -0
- aranova_tracking-0.1.0/src/aranova_tracking/_transport.py +236 -0
- aranova_tracking-0.1.0/src/aranova_tracking/client.py +67 -0
- aranova_tracking-0.1.0/src/aranova_tracking/errors.py +120 -0
- aranova_tracking-0.1.0/src/aranova_tracking/models.py +3753 -0
- aranova_tracking-0.1.0/src/aranova_tracking/py.typed +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aranova
|
|
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,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aranova-tracking
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed Python client for the Aranova tracking API (sales, customers, calendar, config).
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: aranova,tracking,sales,analytics,sdk
|
|
8
|
+
Author: Aranova
|
|
9
|
+
Author-email: ritesh@aranova.io
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Dist: httpx (>=0.27,<1)
|
|
15
|
+
Requires-Dist: pydantic[email] (>=2.7,<3)
|
|
16
|
+
Requires-Dist: tenacity (>=8,<10)
|
|
17
|
+
Project-URL: Homepage, https://aranova.io
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# aranova-tracking
|
|
21
|
+
|
|
22
|
+
Typed Python client for the Aranova tracking API — record sales, read the ledger and
|
|
23
|
+
customer roster, manage calendar bookings, and fetch a business's tracking config from
|
|
24
|
+
your own backend.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install aranova-tracking
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import os
|
|
34
|
+
from aranova_tracking import AranovaTracking
|
|
35
|
+
from aranova_tracking.models import SaleCreateSchema
|
|
36
|
+
|
|
37
|
+
with AranovaTracking(os.environ["ARANOVA_TRACKING_SECRET_KEY"]) as aranova:
|
|
38
|
+
sale = aranova.tracking_sales.record_sale(
|
|
39
|
+
SaleCreateSchema(
|
|
40
|
+
external_id="order-1042", # your id — makes this call idempotent
|
|
41
|
+
currency="CAD",
|
|
42
|
+
amount_total_cents=12_000, # minor units: $120.00
|
|
43
|
+
occurred_at="2026-09-09T14:03:00Z",
|
|
44
|
+
customer_phone="+14165550123",
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
print(sale.id)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Async is the same surface:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from aranova_tracking import AsyncAranovaTracking
|
|
54
|
+
|
|
55
|
+
async with AsyncAranovaTracking(secret_key) as aranova:
|
|
56
|
+
page = await aranova.tracking_sales.query_sales(...)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Your API key
|
|
60
|
+
|
|
61
|
+
Use a **secret** key (`aranv_sk_…`), issued per business in the Aranova dashboard, and
|
|
62
|
+
keep it in server-side env only. A public key (`aranv_pk_…`) authenticates but may only
|
|
63
|
+
*create* sales — every read returns 403. Never ship either key in a browser bundle.
|
|
64
|
+
|
|
65
|
+
## Idempotency
|
|
66
|
+
|
|
67
|
+
`external_id` is your dedup handle. Send the same one twice and the second call returns
|
|
68
|
+
the **existing** sale with HTTP 200 instead of creating a duplicate (a fresh create is
|
|
69
|
+
201). Omit it and there is no dedup at all — a retried request writes a second sale.
|
|
70
|
+
|
|
71
|
+
## Errors
|
|
72
|
+
|
|
73
|
+
Every failure raises a subclass of `AranovaAPIError` carrying a stable `code`, the
|
|
74
|
+
`request_id` to quote when reporting a problem, and any extra `context`:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from aranova_tracking import AranovaAPIError, RateLimitError, ValidationError
|
|
78
|
+
|
|
79
|
+
try:
|
|
80
|
+
aranova.tracking_sales.record_sale(payload)
|
|
81
|
+
except ValidationError as exc:
|
|
82
|
+
print(exc.errors) # per-field failures
|
|
83
|
+
except RateLimitError as exc:
|
|
84
|
+
print(exc.retry_after) # seconds, from the server
|
|
85
|
+
except AranovaAPIError as exc:
|
|
86
|
+
print(exc.code, exc.request_id)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Branch on `exc.code`, never on the message text — prose is free to change, codes are
|
|
90
|
+
contract. Transport failures, 429s and 5xx are retried automatically with exponential
|
|
91
|
+
backoff; 4xx you must fix are raised immediately.
|
|
92
|
+
|
|
93
|
+
## Models are real Pydantic
|
|
94
|
+
|
|
95
|
+
`aranova_tracking.models` is generated from the API's own schemas, so the models are
|
|
96
|
+
genuine `pydantic.BaseModel` classes — usable directly as a FastAPI `response_model`,
|
|
97
|
+
and they validate. They also tolerate unknown fields, so a client pinned to an older
|
|
98
|
+
release keeps working when the API adds one.
|
|
99
|
+
|
|
100
|
+
## Versioning
|
|
101
|
+
|
|
102
|
+
Semantic versioning on the wire contract: a new optional field is a patch, a new
|
|
103
|
+
endpoint a minor, and anything removed or retyped a major. Pin a major
|
|
104
|
+
(`aranova-tracking = "^1.0"`) and upgrade on your own schedule.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
Generated from `apps/api/openapi.json`; `models.py` and `_endpoints.py` are build
|
|
109
|
+
artifacts — see `docs/runbooks/python-sdk.md` in the monorepo.
|
|
110
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# aranova-tracking
|
|
2
|
+
|
|
3
|
+
Typed Python client for the Aranova tracking API — record sales, read the ledger and
|
|
4
|
+
customer roster, manage calendar bookings, and fetch a business's tracking config from
|
|
5
|
+
your own backend.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install aranova-tracking
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import os
|
|
15
|
+
from aranova_tracking import AranovaTracking
|
|
16
|
+
from aranova_tracking.models import SaleCreateSchema
|
|
17
|
+
|
|
18
|
+
with AranovaTracking(os.environ["ARANOVA_TRACKING_SECRET_KEY"]) as aranova:
|
|
19
|
+
sale = aranova.tracking_sales.record_sale(
|
|
20
|
+
SaleCreateSchema(
|
|
21
|
+
external_id="order-1042", # your id — makes this call idempotent
|
|
22
|
+
currency="CAD",
|
|
23
|
+
amount_total_cents=12_000, # minor units: $120.00
|
|
24
|
+
occurred_at="2026-09-09T14:03:00Z",
|
|
25
|
+
customer_phone="+14165550123",
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
print(sale.id)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Async is the same surface:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from aranova_tracking import AsyncAranovaTracking
|
|
35
|
+
|
|
36
|
+
async with AsyncAranovaTracking(secret_key) as aranova:
|
|
37
|
+
page = await aranova.tracking_sales.query_sales(...)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Your API key
|
|
41
|
+
|
|
42
|
+
Use a **secret** key (`aranv_sk_…`), issued per business in the Aranova dashboard, and
|
|
43
|
+
keep it in server-side env only. A public key (`aranv_pk_…`) authenticates but may only
|
|
44
|
+
*create* sales — every read returns 403. Never ship either key in a browser bundle.
|
|
45
|
+
|
|
46
|
+
## Idempotency
|
|
47
|
+
|
|
48
|
+
`external_id` is your dedup handle. Send the same one twice and the second call returns
|
|
49
|
+
the **existing** sale with HTTP 200 instead of creating a duplicate (a fresh create is
|
|
50
|
+
201). Omit it and there is no dedup at all — a retried request writes a second sale.
|
|
51
|
+
|
|
52
|
+
## Errors
|
|
53
|
+
|
|
54
|
+
Every failure raises a subclass of `AranovaAPIError` carrying a stable `code`, the
|
|
55
|
+
`request_id` to quote when reporting a problem, and any extra `context`:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from aranova_tracking import AranovaAPIError, RateLimitError, ValidationError
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
aranova.tracking_sales.record_sale(payload)
|
|
62
|
+
except ValidationError as exc:
|
|
63
|
+
print(exc.errors) # per-field failures
|
|
64
|
+
except RateLimitError as exc:
|
|
65
|
+
print(exc.retry_after) # seconds, from the server
|
|
66
|
+
except AranovaAPIError as exc:
|
|
67
|
+
print(exc.code, exc.request_id)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Branch on `exc.code`, never on the message text — prose is free to change, codes are
|
|
71
|
+
contract. Transport failures, 429s and 5xx are retried automatically with exponential
|
|
72
|
+
backoff; 4xx you must fix are raised immediately.
|
|
73
|
+
|
|
74
|
+
## Models are real Pydantic
|
|
75
|
+
|
|
76
|
+
`aranova_tracking.models` is generated from the API's own schemas, so the models are
|
|
77
|
+
genuine `pydantic.BaseModel` classes — usable directly as a FastAPI `response_model`,
|
|
78
|
+
and they validate. They also tolerate unknown fields, so a client pinned to an older
|
|
79
|
+
release keeps working when the API adds one.
|
|
80
|
+
|
|
81
|
+
## Versioning
|
|
82
|
+
|
|
83
|
+
Semantic versioning on the wire contract: a new optional field is a patch, a new
|
|
84
|
+
endpoint a minor, and anything removed or retyped a major. Pin a major
|
|
85
|
+
(`aranova-tracking = "^1.0"`) and upgrade on your own schedule.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
Generated from `apps/api/openapi.json`; `models.py` and `_endpoints.py` are build
|
|
90
|
+
artifacts — see `docs/runbooks/python-sdk.md` in the monorepo.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "aranova-tracking"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Typed Python client for the Aranova tracking API (sales, customers, calendar, config)."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11" # http.HTTPMethod needs 3.11; 3.10 hits EOL Oct 2026 anyway
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Aranova", email = "ritesh@aranova.io" }]
|
|
10
|
+
keywords = ["aranova", "tracking", "sales", "analytics", "sdk"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
# No "License ::" classifier: PEP 639 deprecates them, and `license` above is
|
|
13
|
+
# the authoritative SPDX expression.
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Typing :: Typed",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"httpx (>=0.27,<1)",
|
|
20
|
+
# `email` extra: generated models use EmailStr, which needs it at import time.
|
|
21
|
+
"pydantic[email] (>=2.7,<3)",
|
|
22
|
+
"tenacity (>=8,<10)",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
# The repository is private; point the public listing at the company site.
|
|
27
|
+
Homepage = "https://aranova.io"
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
31
|
+
build-backend = "poetry.core.masonry.api"
|
|
32
|
+
|
|
33
|
+
[tool.poetry]
|
|
34
|
+
packages = [{ include = "aranova_tracking", from = "src" }]
|
|
35
|
+
|
|
36
|
+
[tool.poetry.group.dev.dependencies]
|
|
37
|
+
pytest = "^8.3.4"
|
|
38
|
+
pytest-asyncio = "^0.25.3"
|
|
39
|
+
respx = "^0.22.0"
|
|
40
|
+
ruff = "^0.15.5"
|
|
41
|
+
mypy = "^1.15.0"
|
|
42
|
+
|
|
43
|
+
[tool.ruff]
|
|
44
|
+
line-length = 100
|
|
45
|
+
target-version = "py311"
|
|
46
|
+
|
|
47
|
+
[tool.ruff.lint]
|
|
48
|
+
select = ["E", "W", "F", "I", "UP", "B", "SIM", "RUF"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff.lint.per-file-ignores]
|
|
51
|
+
# Generated: names and unions are the generator's, not ours to restyle.
|
|
52
|
+
"src/aranova_tracking/models.py" = ["E501", "UP", "RUF"]
|
|
53
|
+
"src/aranova_tracking/_endpoints.py" = ["E501"]
|
|
54
|
+
|
|
55
|
+
[tool.mypy]
|
|
56
|
+
python_version = "3.11"
|
|
57
|
+
strict = true
|
|
58
|
+
|
|
59
|
+
# The two generated modules, each suppressing exactly one code with a reason.
|
|
60
|
+
# `models`: datamodel-code-generator emits defaults mypy reads as incompatible.
|
|
61
|
+
# `_endpoints`: the transport returns Any, but `_parse` validates to the declared
|
|
62
|
+
# model at runtime, so the annotation is true even though mypy cannot infer it.
|
|
63
|
+
[[tool.mypy.overrides]]
|
|
64
|
+
module = "aranova_tracking.models"
|
|
65
|
+
disable_error_code = ["assignment"]
|
|
66
|
+
|
|
67
|
+
[[tool.mypy.overrides]]
|
|
68
|
+
module = "aranova_tracking._endpoints"
|
|
69
|
+
disable_error_code = ["no-any-return"]
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
asyncio_mode = "auto"
|
|
74
|
+
markers = [
|
|
75
|
+
"integration: needs a live API (ARANOVA_TEST_BASE_URL/SECRET_KEY); skipped by default",
|
|
76
|
+
]
|
|
77
|
+
# `test_transport.py` (respx-mocked) always runs. Integration tests are opt-in
|
|
78
|
+
# so a bare `poetry run pytest` never needs a running server: CI passes `-m integration`.
|
|
79
|
+
addopts = "-m 'not integration'"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Typed Python client for the Aranova tracking API.
|
|
2
|
+
|
|
3
|
+
Import models from `aranova_tracking.models` — they are real Pydantic v2 models
|
|
4
|
+
generated from the API's own schemas, so a FastAPI service can reuse them directly
|
|
5
|
+
as a `response_model`.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from aranova_tracking.client import AranovaTracking, AsyncAranovaTracking
|
|
9
|
+
from aranova_tracking.errors import (
|
|
10
|
+
AranovaAPIError,
|
|
11
|
+
AranovaError,
|
|
12
|
+
AuthenticationError,
|
|
13
|
+
ConflictError,
|
|
14
|
+
NotFoundError,
|
|
15
|
+
PermissionDeniedError,
|
|
16
|
+
RateLimitError,
|
|
17
|
+
ValidationError,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__version__ = "0.1.0"
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"AranovaAPIError",
|
|
24
|
+
"AranovaError",
|
|
25
|
+
"AranovaTracking",
|
|
26
|
+
"AsyncAranovaTracking",
|
|
27
|
+
"AuthenticationError",
|
|
28
|
+
"ConflictError",
|
|
29
|
+
"NotFoundError",
|
|
30
|
+
"PermissionDeniedError",
|
|
31
|
+
"RateLimitError",
|
|
32
|
+
"ValidationError",
|
|
33
|
+
"__version__",
|
|
34
|
+
]
|