vendorval-sdk 0.2.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.
- vendorval_sdk-0.2.0/.gitignore +32 -0
- vendorval_sdk-0.2.0/CHANGELOG.md +37 -0
- vendorval_sdk-0.2.0/LICENSE +21 -0
- vendorval_sdk-0.2.0/PKG-INFO +114 -0
- vendorval_sdk-0.2.0/README.md +85 -0
- vendorval_sdk-0.2.0/pyproject.toml +71 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/__init__.py +44 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_async_client.py +84 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_client.py +87 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_errors.py +205 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_idempotency.py +10 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_models.py +59 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_pagination.py +34 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_request.py +309 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_retry.py +50 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_version.py +2 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/_webhooks.py +85 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/py.typed +0 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/resources/__init__.py +0 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/resources/_entities.py +134 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/resources/_meta.py +88 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/resources/_monitors.py +97 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/resources/_simple.py +77 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/resources/_verifications.py +311 -0
- vendorval_sdk-0.2.0/src/vendorval_sdk/types.py +199 -0
- vendorval_sdk-0.2.0/tests/__init__.py +0 -0
- vendorval_sdk-0.2.0/tests/test_async.py +25 -0
- vendorval_sdk-0.2.0/tests/test_client.py +64 -0
- vendorval_sdk-0.2.0/tests/test_country.py +313 -0
- vendorval_sdk-0.2.0/tests/test_errors.py +122 -0
- vendorval_sdk-0.2.0/tests/test_retry.py +69 -0
- vendorval_sdk-0.2.0/tests/test_webhooks.py +49 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
build/
|
|
4
|
+
*.tsbuildinfo
|
|
5
|
+
.turbo/
|
|
6
|
+
.pnpm-store/
|
|
7
|
+
|
|
8
|
+
# Python
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[cod]
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.venv/
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
.ruff_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
htmlcov/
|
|
17
|
+
coverage.xml
|
|
18
|
+
.coverage
|
|
19
|
+
|
|
20
|
+
# editor
|
|
21
|
+
.vscode/
|
|
22
|
+
.idea/
|
|
23
|
+
.DS_Store
|
|
24
|
+
|
|
25
|
+
# env
|
|
26
|
+
.env
|
|
27
|
+
.env.local
|
|
28
|
+
|
|
29
|
+
# Local scratch — the canonical live smoke harnesses live under
|
|
30
|
+
# examples/{node,python}/live-smoke/. Keep test-python/ out of commits in
|
|
31
|
+
# case it stays around in working trees.
|
|
32
|
+
test-python/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# vendorval-sdk (Python)
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-05-05
|
|
4
|
+
|
|
5
|
+
**Breaking:** Renamed PyPI distribution from `vendorval` to `vendorval-sdk` and import path from `vendorval` to `vendorval_sdk` to avoid collisions with the `vendorval` Frappe app and other downstream packages that want to claim the `vendorval` namespace. Update consumers:
|
|
6
|
+
|
|
7
|
+
```diff
|
|
8
|
+
- pip install vendorval
|
|
9
|
+
+ pip install vendorval-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```diff
|
|
13
|
+
- from vendorval import Vendorval
|
|
14
|
+
+ from vendorval_sdk import Vendorval
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The public class names (`Vendorval`, `AsyncVendorval`, error types, `construct_event`, …) and their behaviour are unchanged.
|
|
18
|
+
|
|
19
|
+
**New — country-aware SDK surface (Phase J):**
|
|
20
|
+
|
|
21
|
+
- `IdentifierType` extended with `vat_id`; `CheckType` extended with `vat_validation`, `lei_validation`, `sanctions_screening`.
|
|
22
|
+
- New `CountryCode`, `EntityRegion`, `CountryTier` types and a typed `SupportedCountrySummary` / `SupportedCountriesResponse` pair mirroring `/v1/meta/countries`.
|
|
23
|
+
- New `MetaResource` exposing `client.meta.list_supported_countries()` and `client.meta.get_supported_country(code)` (sync + async).
|
|
24
|
+
- `entities.lookup` / `verifications.create` accept an optional `country` parameter that is forwarded to the API.
|
|
25
|
+
- New `CountryError` (subclass of `ValidationError`) wired into the response-to-error mapping for the five 422 codes: `country_required`, `country_not_supported`, `identifier_not_supported_for_country`, `check_not_supported_for_country`, `country_mismatch`. Plain 422 responses now map to `ValidationError` so non-country semantic violations inherit the same catch-all behaviour.
|
|
26
|
+
|
|
27
|
+
## 0.1.0 — Unreleased
|
|
28
|
+
|
|
29
|
+
Initial public release.
|
|
30
|
+
|
|
31
|
+
- `Vendorval` (sync) and `AsyncVendorval` (async) clients with `api_key` / `base_url` / `timeout` / `max_retries` options.
|
|
32
|
+
- Resources: `entities`, `verifications` (incl. `create_and_wait`), `monitors`, `providers`, `usage`, `jobs`.
|
|
33
|
+
- Auto-retry on `429` and `5xx` honoring `retry-after` and `x-ratelimit-reset`.
|
|
34
|
+
- Auto-generated idempotency keys for retried POSTs to verification endpoints.
|
|
35
|
+
- Typed errors: `AuthenticationError`, `PermissionError`, `ValidationError`, `RateLimitError`, `NotFoundError`, `ConflictError`, `ProviderError`, `APIError`.
|
|
36
|
+
- `request_id` exposed on every response and error.
|
|
37
|
+
- Forward-compatible `webhooks.construct_event` (placeholder until outbound delivery ships).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Modali Consulting
|
|
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,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vendorval-sdk
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Python SDK for the VendorVal API
|
|
5
|
+
Project-URL: Homepage, https://docs.vendorval.com
|
|
6
|
+
Project-URL: Documentation, https://docs.vendorval.com
|
|
7
|
+
Project-URL: Source, https://github.com/Modali-Consulting/vendorval-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/Modali-Consulting/vendorval-sdk/issues
|
|
9
|
+
Author: Modali Consulting
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,compliance,sam.gov,sdk,tin,vendor,vendorval,verification
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Requires-Dist: httpx>=0.25
|
|
27
|
+
Requires-Dist: typing-extensions>=4.7; python_version < '3.11'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# vendorval-sdk
|
|
31
|
+
|
|
32
|
+
Official Python SDK for the [VendorVal API](https://docs.vendorval.com).
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install vendorval-sdk
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from vendorval_sdk import Vendorval
|
|
42
|
+
|
|
43
|
+
client = Vendorval() # reads VENDORVAL_API_KEY from env
|
|
44
|
+
|
|
45
|
+
# 1) Look up an entity by identifier
|
|
46
|
+
lookup = client.entities.lookup(identifiers={"uei": "ABCD12345678"})
|
|
47
|
+
if lookup.match == "not_found":
|
|
48
|
+
raise SystemExit("entity not in registry")
|
|
49
|
+
|
|
50
|
+
# 2) Run a verification and wait for the terminal result
|
|
51
|
+
bundle = client.verifications.create_and_wait(
|
|
52
|
+
identifiers=[{"type": "uei", "value": "ABCD12345678"}],
|
|
53
|
+
legal_name="Acme Federal Services LLC",
|
|
54
|
+
checks=["sam_registration"],
|
|
55
|
+
mode="cached",
|
|
56
|
+
)
|
|
57
|
+
print(bundle.verification.overall_result)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Async
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import asyncio
|
|
64
|
+
from vendorval_sdk import AsyncVendorval
|
|
65
|
+
|
|
66
|
+
async def main() -> None:
|
|
67
|
+
async with AsyncVendorval() as client:
|
|
68
|
+
result = await client.entities.lookup(identifiers={"uei": "ABCD12345678"})
|
|
69
|
+
print(result.match)
|
|
70
|
+
|
|
71
|
+
asyncio.run(main())
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
client = Vendorval(
|
|
78
|
+
api_key="vv_live_…",
|
|
79
|
+
base_url="https://api.vendorval.com",
|
|
80
|
+
timeout=30.0, # seconds, default 60
|
|
81
|
+
max_retries=2, # default 2
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
API keys are prefixed `vv_test_` (sandbox) or `vv_live_` (production). The SDK validates the prefix client-side.
|
|
86
|
+
|
|
87
|
+
## Errors
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from vendorval_sdk import RateLimitError, ConflictError, ValidationError
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
client.verifications.create(...)
|
|
94
|
+
except RateLimitError as err:
|
|
95
|
+
print("rate limited, retry after", err.retry_after, "seconds")
|
|
96
|
+
except ConflictError as err:
|
|
97
|
+
print("ambiguous match", err.candidates)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
All errors carry `request_id`, `status`, `code`, `type`, `message`.
|
|
101
|
+
|
|
102
|
+
## Webhooks
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from vendorval_sdk import construct_event
|
|
106
|
+
|
|
107
|
+
event = construct_event(raw_body, signature_header, secret)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> Outbound webhook delivery is not enabled in the API yet; this helper exists so handler code is ready when delivery lands.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# vendorval-sdk
|
|
2
|
+
|
|
3
|
+
Official Python SDK for the [VendorVal API](https://docs.vendorval.com).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install vendorval-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from vendorval_sdk import Vendorval
|
|
13
|
+
|
|
14
|
+
client = Vendorval() # reads VENDORVAL_API_KEY from env
|
|
15
|
+
|
|
16
|
+
# 1) Look up an entity by identifier
|
|
17
|
+
lookup = client.entities.lookup(identifiers={"uei": "ABCD12345678"})
|
|
18
|
+
if lookup.match == "not_found":
|
|
19
|
+
raise SystemExit("entity not in registry")
|
|
20
|
+
|
|
21
|
+
# 2) Run a verification and wait for the terminal result
|
|
22
|
+
bundle = client.verifications.create_and_wait(
|
|
23
|
+
identifiers=[{"type": "uei", "value": "ABCD12345678"}],
|
|
24
|
+
legal_name="Acme Federal Services LLC",
|
|
25
|
+
checks=["sam_registration"],
|
|
26
|
+
mode="cached",
|
|
27
|
+
)
|
|
28
|
+
print(bundle.verification.overall_result)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Async
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
import asyncio
|
|
35
|
+
from vendorval_sdk import AsyncVendorval
|
|
36
|
+
|
|
37
|
+
async def main() -> None:
|
|
38
|
+
async with AsyncVendorval() as client:
|
|
39
|
+
result = await client.entities.lookup(identifiers={"uei": "ABCD12345678"})
|
|
40
|
+
print(result.match)
|
|
41
|
+
|
|
42
|
+
asyncio.run(main())
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
client = Vendorval(
|
|
49
|
+
api_key="vv_live_…",
|
|
50
|
+
base_url="https://api.vendorval.com",
|
|
51
|
+
timeout=30.0, # seconds, default 60
|
|
52
|
+
max_retries=2, # default 2
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
API keys are prefixed `vv_test_` (sandbox) or `vv_live_` (production). The SDK validates the prefix client-side.
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from vendorval_sdk import RateLimitError, ConflictError, ValidationError
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
client.verifications.create(...)
|
|
65
|
+
except RateLimitError as err:
|
|
66
|
+
print("rate limited, retry after", err.retry_after, "seconds")
|
|
67
|
+
except ConflictError as err:
|
|
68
|
+
print("ambiguous match", err.candidates)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
All errors carry `request_id`, `status`, `code`, `type`, `message`.
|
|
72
|
+
|
|
73
|
+
## Webhooks
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from vendorval_sdk import construct_event
|
|
77
|
+
|
|
78
|
+
event = construct_event(raw_body, signature_header, secret)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> Outbound webhook delivery is not enabled in the API yet; this helper exists so handler code is ready when delivery lands.
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vendorval-sdk"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Official Python SDK for the VendorVal API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [{ name = "Modali Consulting" }]
|
|
13
|
+
keywords = ["vendorval", "vendor", "verification", "sam.gov", "tin", "compliance", "api", "sdk"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"httpx>=0.25",
|
|
30
|
+
"typing-extensions>=4.7; python_version<'3.11'",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://docs.vendorval.com"
|
|
35
|
+
Documentation = "https://docs.vendorval.com"
|
|
36
|
+
Source = "https://github.com/Modali-Consulting/vendorval-sdk"
|
|
37
|
+
Issues = "https://github.com/Modali-Consulting/vendorval-sdk/issues"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=8",
|
|
42
|
+
"pytest-asyncio>=0.23",
|
|
43
|
+
"respx>=0.21",
|
|
44
|
+
"ruff>=0.5",
|
|
45
|
+
"mypy>=1.10",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/vendorval_sdk"]
|
|
50
|
+
|
|
51
|
+
[tool.hatch.build.targets.sdist]
|
|
52
|
+
include = ["src", "tests", "README.md", "LICENSE", "CHANGELOG.md", "pyproject.toml"]
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
asyncio_mode = "auto"
|
|
57
|
+
pythonpath = ["src"]
|
|
58
|
+
|
|
59
|
+
[tool.ruff]
|
|
60
|
+
target-version = "py39"
|
|
61
|
+
line-length = 100
|
|
62
|
+
|
|
63
|
+
[tool.ruff.lint]
|
|
64
|
+
select = ["E", "F", "I", "N", "B", "UP", "SIM"]
|
|
65
|
+
ignore = ["E501"]
|
|
66
|
+
|
|
67
|
+
[tool.mypy]
|
|
68
|
+
python_version = "3.9"
|
|
69
|
+
strict = true
|
|
70
|
+
mypy_path = "src"
|
|
71
|
+
packages = ["vendorval_sdk"]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Official Python SDK for the VendorVal API."""
|
|
2
|
+
|
|
3
|
+
from ._async_client import AsyncVendorval
|
|
4
|
+
from ._client import Vendorval
|
|
5
|
+
from ._errors import (
|
|
6
|
+
APIConnectionError,
|
|
7
|
+
APIError,
|
|
8
|
+
APITimeoutError,
|
|
9
|
+
AuthenticationError,
|
|
10
|
+
ConflictError,
|
|
11
|
+
CountryError,
|
|
12
|
+
NotFoundError,
|
|
13
|
+
PermissionError,
|
|
14
|
+
ProviderError,
|
|
15
|
+
RateLimitError,
|
|
16
|
+
ValidationError,
|
|
17
|
+
VendorvalError,
|
|
18
|
+
)
|
|
19
|
+
from ._idempotency import generate_idempotency_key
|
|
20
|
+
from ._pagination import Page
|
|
21
|
+
from ._version import API_VERSION, VERSION
|
|
22
|
+
from ._webhooks import construct_event
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"API_VERSION",
|
|
26
|
+
"APIConnectionError",
|
|
27
|
+
"APIError",
|
|
28
|
+
"APITimeoutError",
|
|
29
|
+
"AsyncVendorval",
|
|
30
|
+
"AuthenticationError",
|
|
31
|
+
"ConflictError",
|
|
32
|
+
"CountryError",
|
|
33
|
+
"NotFoundError",
|
|
34
|
+
"Page",
|
|
35
|
+
"PermissionError",
|
|
36
|
+
"ProviderError",
|
|
37
|
+
"RateLimitError",
|
|
38
|
+
"VERSION",
|
|
39
|
+
"ValidationError",
|
|
40
|
+
"Vendorval",
|
|
41
|
+
"VendorvalError",
|
|
42
|
+
"construct_event",
|
|
43
|
+
"generate_idempotency_key",
|
|
44
|
+
]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Asynchronous client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ._request import resolve_config
|
|
10
|
+
from ._version import API_VERSION, VERSION
|
|
11
|
+
from ._webhooks import construct_event
|
|
12
|
+
from .resources._entities import AsyncEntitiesResource
|
|
13
|
+
from .resources._meta import AsyncMetaResource
|
|
14
|
+
from .resources._monitors import AsyncMonitorsResource
|
|
15
|
+
from .resources._simple import AsyncJobsResource, AsyncProvidersResource, AsyncUsageResource
|
|
16
|
+
from .resources._verifications import AsyncVerificationsResource
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _Webhooks:
|
|
20
|
+
construct_event = staticmethod(construct_event)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class AsyncVendorval:
|
|
24
|
+
"""Asynchronous VendorVal client.
|
|
25
|
+
|
|
26
|
+
Use as an async context manager so the underlying httpx client is closed:
|
|
27
|
+
|
|
28
|
+
async with AsyncVendorval() as client:
|
|
29
|
+
await client.entities.lookup(identifiers={"uei": "ABCD12345678"})
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
VERSION = VERSION
|
|
33
|
+
API_VERSION = API_VERSION
|
|
34
|
+
|
|
35
|
+
def __init__(
|
|
36
|
+
self,
|
|
37
|
+
*,
|
|
38
|
+
api_key: str | None = None,
|
|
39
|
+
base_url: str | None = None,
|
|
40
|
+
timeout: float | None = None,
|
|
41
|
+
max_retries: int | None = None,
|
|
42
|
+
validate_api_key: bool = True,
|
|
43
|
+
http_client: httpx.AsyncClient | None = None,
|
|
44
|
+
) -> None:
|
|
45
|
+
self._cfg = resolve_config(
|
|
46
|
+
api_key=api_key,
|
|
47
|
+
base_url=base_url,
|
|
48
|
+
timeout=timeout,
|
|
49
|
+
max_retries=max_retries,
|
|
50
|
+
validate_api_key=validate_api_key,
|
|
51
|
+
)
|
|
52
|
+
self._owns_http = http_client is None
|
|
53
|
+
self._http = http_client or httpx.AsyncClient(timeout=self._cfg.timeout)
|
|
54
|
+
self.entities = AsyncEntitiesResource(self._cfg, self._http)
|
|
55
|
+
self.verifications = AsyncVerificationsResource(self._cfg, self._http)
|
|
56
|
+
self.monitors = AsyncMonitorsResource(self._cfg, self._http)
|
|
57
|
+
self.providers = AsyncProvidersResource(self._cfg, self._http)
|
|
58
|
+
self.meta = AsyncMetaResource(self._cfg, self._http)
|
|
59
|
+
self.usage = AsyncUsageResource(self._cfg, self._http)
|
|
60
|
+
self.jobs = AsyncJobsResource(self._cfg, self._http)
|
|
61
|
+
self.webhooks = _Webhooks()
|
|
62
|
+
|
|
63
|
+
async def aclose(self) -> None:
|
|
64
|
+
if self._owns_http:
|
|
65
|
+
await self._http.aclose()
|
|
66
|
+
|
|
67
|
+
async def __aenter__(self) -> AsyncVendorval:
|
|
68
|
+
return self
|
|
69
|
+
|
|
70
|
+
async def __aexit__(
|
|
71
|
+
self,
|
|
72
|
+
exc_type: type[BaseException] | None,
|
|
73
|
+
exc: BaseException | None,
|
|
74
|
+
tb: TracebackType | None,
|
|
75
|
+
) -> None:
|
|
76
|
+
await self.aclose()
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def api_key(self) -> str:
|
|
80
|
+
return self._cfg.api_key
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def base_url(self) -> str:
|
|
84
|
+
return self._cfg.base_url
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Synchronous client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from types import TracebackType
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ._request import resolve_config
|
|
10
|
+
from ._version import API_VERSION, VERSION
|
|
11
|
+
from ._webhooks import construct_event
|
|
12
|
+
from .resources._entities import EntitiesResource
|
|
13
|
+
from .resources._meta import MetaResource
|
|
14
|
+
from .resources._monitors import MonitorsResource
|
|
15
|
+
from .resources._simple import JobsResource, ProvidersResource, UsageResource
|
|
16
|
+
from .resources._verifications import VerificationsResource
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _Webhooks:
|
|
20
|
+
construct_event = staticmethod(construct_event)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Vendorval:
|
|
24
|
+
"""Synchronous VendorVal client.
|
|
25
|
+
|
|
26
|
+
Construct directly or use as a context manager:
|
|
27
|
+
|
|
28
|
+
with Vendorval() as client:
|
|
29
|
+
client.entities.lookup(identifiers={"uei": "ABCD12345678"})
|
|
30
|
+
|
|
31
|
+
The constructor reads `VENDORVAL_API_KEY` and `VENDORVAL_BASE_URL` from
|
|
32
|
+
the environment if not supplied.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
VERSION = VERSION
|
|
36
|
+
API_VERSION = API_VERSION
|
|
37
|
+
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
*,
|
|
41
|
+
api_key: str | None = None,
|
|
42
|
+
base_url: str | None = None,
|
|
43
|
+
timeout: float | None = None,
|
|
44
|
+
max_retries: int | None = None,
|
|
45
|
+
validate_api_key: bool = True,
|
|
46
|
+
http_client: httpx.Client | None = None,
|
|
47
|
+
) -> None:
|
|
48
|
+
self._cfg = resolve_config(
|
|
49
|
+
api_key=api_key,
|
|
50
|
+
base_url=base_url,
|
|
51
|
+
timeout=timeout,
|
|
52
|
+
max_retries=max_retries,
|
|
53
|
+
validate_api_key=validate_api_key,
|
|
54
|
+
)
|
|
55
|
+
self._owns_http = http_client is None
|
|
56
|
+
self._http = http_client or httpx.Client(timeout=self._cfg.timeout)
|
|
57
|
+
self.entities = EntitiesResource(self._cfg, self._http)
|
|
58
|
+
self.verifications = VerificationsResource(self._cfg, self._http)
|
|
59
|
+
self.monitors = MonitorsResource(self._cfg, self._http)
|
|
60
|
+
self.providers = ProvidersResource(self._cfg, self._http)
|
|
61
|
+
self.meta = MetaResource(self._cfg, self._http)
|
|
62
|
+
self.usage = UsageResource(self._cfg, self._http)
|
|
63
|
+
self.jobs = JobsResource(self._cfg, self._http)
|
|
64
|
+
self.webhooks = _Webhooks()
|
|
65
|
+
|
|
66
|
+
def close(self) -> None:
|
|
67
|
+
if self._owns_http:
|
|
68
|
+
self._http.close()
|
|
69
|
+
|
|
70
|
+
def __enter__(self) -> Vendorval:
|
|
71
|
+
return self
|
|
72
|
+
|
|
73
|
+
def __exit__(
|
|
74
|
+
self,
|
|
75
|
+
exc_type: type[BaseException] | None,
|
|
76
|
+
exc: BaseException | None,
|
|
77
|
+
tb: TracebackType | None,
|
|
78
|
+
) -> None:
|
|
79
|
+
self.close()
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def api_key(self) -> str:
|
|
83
|
+
return self._cfg.api_key
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def base_url(self) -> str:
|
|
87
|
+
return self._cfg.base_url
|