valotcg 1.0.1__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,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ build/
5
+ dist/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ .coverage
11
+ htmlcov/
12
+ .env
13
+ .env.*
14
+ .DS_Store
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 1.0.1 (2026-11-07)
4
+
5
+ Initial release, aligned with Valo.Data API 1.0.1.
6
+
7
+ - `ValoData` (sync) and `AsyncValoData` (async) clients on httpx.
8
+ - The 20 operations of the OpenAPI document, grouped as `games`, `editions`, `cards`, `sealed`,
9
+ `analysis` and `usage()`.
10
+ - Pydantic v2 models generated from `openapi.json` by `scripts/regenerate.py`.
11
+ - `Response[T]` with `.data` and `.meta` (credits used, credits remaining, request id, rate limit headers).
12
+ - Typed errors: `AuthenticationError`, `PermissionDeniedError`, `NotFoundError`, `ValidationError`,
13
+ `RateLimitError`, `ServerError`, `APIConnectionError`.
14
+ - Automatic retry on `429 rate_limited` after `Retry-After` (`max_retries`, default 2).
15
+ - Cursor pagination: `cards.iter_search`, `sealed.iter_search`, `editions.iter_list`, `paginate`, `apaginate`.
@@ -0,0 +1,33 @@
1
+ # Contributing
2
+
3
+ ## Setup
4
+
5
+ ```bash
6
+ uv sync
7
+ uv run ruff check
8
+ uv run ruff format --check
9
+ uv run pytest -v
10
+ ```
11
+
12
+ `tests/test_live.py` calls the real API and runs only when `VALO_DATA_API_KEY` is set (about 2 credits).
13
+
14
+ ## Regenerating the models
15
+
16
+ `src/valotcg/models.py` is generated from `openapi.json` with
17
+ [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator). Do not edit it by hand.
18
+
19
+ ```bash
20
+ uv run python scripts/regenerate.py # re-download openapi.json, then regenerate models.py
21
+ uv run python scripts/regenerate.py --offline # regenerate from the pinned openapi.json
22
+ ```
23
+
24
+ Commit both `openapi.json` and `src/valotcg/models.py`. When the API adds or changes a route, also update
25
+ `src/valotcg/_routes.py`, `src/valotcg/_resources.py`, `tests/test_routes.py` and the README table, then run
26
+ the test suite: `test_every_openapi_operation_is_covered` fails when an operation has no client method.
27
+
28
+ ## Releasing
29
+
30
+ 1. Set the version in `src/valotcg/_version.py` (aligned with the API version when the spec changes).
31
+ 2. Add an entry to `CHANGELOG.md`.
32
+ 3. Tag `vX.Y.Z` on `main` and push the tag: `.github/workflows/publish.yml` builds and publishes to PyPI
33
+ through trusted publishing.
valotcg-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ValoTCG
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.
valotcg-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.5
2
+ Name: valotcg
3
+ Version: 1.0.1
4
+ Summary: Official Python client for Valo.Data, the ValoTCG trading card price API.
5
+ Project-URL: Homepage, https://valotcg.com/developers
6
+ Project-URL: Documentation, https://valotcg.com/developers/docs
7
+ Project-URL: Repository, https://github.com/valotcg/valo-data-python
8
+ Project-URL: Changelog, https://github.com/valotcg/valo-data-python/blob/main/CHANGELOG.md
9
+ Project-URL: OpenAPI, https://api.valotcg.com/data/v1/openapi.json
10
+ Author: ValoTCG
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: api client,card prices,tcg,trading cards,valo-data,valotcg
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
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.10
26
+ Requires-Dist: httpx<1,>=0.27
27
+ Requires-Dist: pydantic<3,>=2.6
28
+ Description-Content-Type: text/markdown
29
+
30
+ # valotcg: Python client for Valo.Data
31
+
32
+ Official Python client for [Valo.Data](https://valotcg.com/developers), the ValoTCG trading card price API:
33
+ catalogue, prices, price history and analysis for 14 TCGs (Pokémon, One Piece, Yu-Gi-Oh!, Magic, Lorcana and more),
34
+ with Cardmarket, US market and eBay sources.
35
+
36
+ - Sync (`ValoData`) and async (`AsyncValoData`) clients on [httpx](https://www.python-httpx.org/)
37
+ - Typed pydantic v2 models generated from the [OpenAPI document](https://api.valotcg.com/data/v1/openapi.json)
38
+ - Credits and request id on every response, typed errors, automatic retry on transient rate limits
39
+ - Cursor pagination helpers
40
+
41
+ Python 3.10 or later.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install valotcg
47
+ # or
48
+ uv add valotcg
49
+ ```
50
+
51
+ ## API key
52
+
53
+ Create a free Sandbox key at [valotcg.com/developers/account](https://valotcg.com/developers/account):
54
+ 500 credits and 250 distinct cards per month, 100 billed requests per day, no credit card.
55
+ Plans and credit costs: [valotcg.com/developers/pricing](https://valotcg.com/developers/pricing).
56
+
57
+ The client reads the key from `api_key=` or from the `VALO_DATA_API_KEY` environment variable and sends it as
58
+ `Authorization: Bearer <key>`.
59
+
60
+ ```bash
61
+ export VALO_DATA_API_KEY=vd_test_...
62
+ ```
63
+
64
+ ## Identify a card, then get its price summary
65
+
66
+ ```python
67
+ from valotcg import ValoData
68
+
69
+ with ValoData() as client:
70
+ found = client.analysis.identify("charizard 4/102", game="pokemon")
71
+ card = found.data.candidates[0].card
72
+ summary = client.analysis.card_summary(card.card_id)
73
+ print(card.name, summary.data.recommended)
74
+ print("credits used:", summary.meta.credits_used, "remaining:", summary.meta.credits_remaining)
75
+ ```
76
+
77
+ ## Batch prices
78
+
79
+ Up to 100 ids per call; sealed products are written `"sealed:<id>"`.
80
+
81
+ ```python
82
+ batch = client.cards.batch([1234, 5678, "sealed:42"])
83
+ for item in batch.data.items:
84
+ if item.status == "ok":
85
+ for quote in item.prices or []:
86
+ print(item.id, quote.source, quote.metric, quote.amount, quote.currency)
87
+ ```
88
+
89
+ ## Pagination
90
+
91
+ Search endpoints return one page and a `next_cursor`. The iterators fetch the next pages lazily
92
+ (each page is a billed request, stop iterating to stop fetching):
93
+
94
+ ```python
95
+ for card in client.cards.iter_search("pokemon", q="pikachu", language="fr"):
96
+ print(card.card_id, card.name)
97
+
98
+ # Any paginated method, sync or async:
99
+ from valotcg import apaginate, paginate
100
+
101
+ for edition in paginate(client.editions.list, "onepiece"):
102
+ print(edition.name)
103
+ ```
104
+
105
+ Available iterators: `cards.iter_search`, `sealed.iter_search`, `editions.iter_list`.
106
+
107
+ ## Async
108
+
109
+ ```python
110
+ import asyncio
111
+ from valotcg import AsyncValoData
112
+
113
+
114
+ async def main() -> None:
115
+ async with AsyncValoData() as client:
116
+ movers = await client.analysis.top_movers("pokemon", period=7, direction="up")
117
+ for mover in movers.data.items:
118
+ print(mover)
119
+ async for card in client.cards.iter_search("lorcana", q="elsa"):
120
+ print(card.name)
121
+
122
+
123
+ asyncio.run(main())
124
+ ```
125
+
126
+ ## Responses
127
+
128
+ Every method returns a `Response[T]`:
129
+
130
+ - `response.data`: the typed model (`valotcg.models`)
131
+ - `response.meta`: `credits_used`, `credits_remaining`, `request_id` (headers `X-Credits-Used`,
132
+ `X-Credits-Remaining`, `X-Request-Id`), plus `rate_limit_limit`, `rate_limit_remaining`,
133
+ `rate_limit_reset`, `status_code` and raw `headers`
134
+ - shortcuts: `response.credits_used`, `response.credits_remaining`, `response.request_id`, and attribute
135
+ access falls through to `.data` (`response.candidates` is `response.data.candidates`)
136
+
137
+ Free routes (`games.list`, `games.rarities`, `usage`) may return no credit headers; the fields are then `None`.
138
+
139
+ ## Routes
140
+
141
+ | Method | HTTP route |
142
+ |---|---|
143
+ | `client.games.list()` | `GET /data/v1/games` |
144
+ | `client.games.rarities(game)` | `GET /data/v1/games/{game}/rarities` |
145
+ | `client.editions.list(game, q=, language=, cursor=, page_size=)` | `GET /data/v1/editions` |
146
+ | `client.cards.search(game, q=, edition_id=, language=, rarity=, cursor=, page_size=)` | `GET /data/v1/cards` |
147
+ | `client.cards.get(card_id)` | `GET /data/v1/cards/{card_id}` |
148
+ | `client.cards.prices(card_id, include=)` | `GET /data/v1/cards/{card_id}/prices` |
149
+ | `client.cards.batch(ids, include=)` | `POST /data/v1/cards/batch` |
150
+ | `client.cards.price_history(card_id, source=, variant=, from_=, to=, market_language=, condition=)` | `GET /data/v1/cards/{card_id}/price-history` |
151
+ | `client.sealed.search(game, q=, edition_id=, product_type=, language=, cursor=, page_size=)` | `GET /data/v1/sealed` |
152
+ | `client.sealed.get(sealed_id)` | `GET /data/v1/sealed/{sealed_id}` |
153
+ | `client.sealed.prices(sealed_id)` | `GET /data/v1/sealed/{sealed_id}/prices` |
154
+ | `client.sealed.price_history(sealed_id, source=, from_=, to=)` | `GET /data/v1/sealed/{sealed_id}/price-history` |
155
+ | `client.analysis.identify(q, game=, language=)` | `GET /data/v1/analysis/identify` |
156
+ | `client.analysis.card_summary(card_id, include=)` | `GET /data/v1/analysis/cards/{card_id}/summary` |
157
+ | `client.analysis.sealed_summary(sealed_id)` | `GET /data/v1/analysis/sealed/{sealed_id}/summary` |
158
+ | `client.analysis.compare(ids, include=)` | `POST /data/v1/analysis/compare` |
159
+ | `client.analysis.top_movers(game, period=, direction=, edition_id=, language=, limit=, reliable=)` | `GET /data/v1/analysis/top-movers` |
160
+ | `client.analysis.top_priced(game, kind=, language=, edition_id=, product_type=, limit=)` | `GET /data/v1/analysis/top-priced` |
161
+ | `client.analysis.edition_overview(edition_id)` | `GET /data/v1/analysis/editions/{edition_id}/overview` |
162
+ | `client.usage(product=)` | `GET /developer/v1/usage` |
163
+
164
+ `from_` maps to the `from` query parameter. `include` accepts a list (`["graded", "population"]`) or a
165
+ comma separated string. Price sources are `cardmarket`, `us_market` and `ebay`.
166
+
167
+ ## Errors
168
+
169
+ Error bodies `{"error": {"code", "message", "request_id", "docs_url"}}` raise typed exceptions, all subclasses
170
+ of `valotcg.ValoDataError` with `status_code`, `code`, `message`, `request_id` and `docs_url`:
171
+
172
+ | Exception | Status | Example codes |
173
+ |---|---|---|
174
+ | `AuthenticationError` | 401 | `invalid_api_key`, `api_key_expired` |
175
+ | `PermissionDeniedError` | 403 | `insufficient_scope`, `plan_feature_unavailable`, `ip_not_allowed` |
176
+ | `NotFoundError` | 404 | `card_not_found`, `sealed_not_found`, `edition_not_found` |
177
+ | `ValidationError` | 400, 422 | `invalid_request`, `invalid_cursor`, `range_exceeds_plan` |
178
+ | `RateLimitError` | 429 | `rate_limited`, `quota_exceeded`, `daily_limit_reached`, `catalog_limit_reached` |
179
+ | `ServerError` | 5xx | `quota_unavailable` |
180
+ | `APIConnectionError` | none | network failure or timeout |
181
+
182
+ `RateLimitError` also carries `retry_after` (seconds, from `Retry-After`) and `resets_at` (when a credit limit
183
+ resets). `valotcg.ValidationError` is distinct from `pydantic.ValidationError`.
184
+
185
+ ```python
186
+ from valotcg import NotFoundError, RateLimitError
187
+
188
+ try:
189
+ client.cards.get(999999999)
190
+ except NotFoundError as exc:
191
+ print(exc.code, exc.request_id)
192
+ except RateLimitError as exc:
193
+ print(exc.code, exc.resets_at)
194
+ ```
195
+
196
+ ### Retries
197
+
198
+ A `429` with code `rate_limited` (or `concurrency_limited`) is retried after `Retry-After` seconds
199
+ (capped at 60), up to `max_retries` times (default 2). Credit limits (`quota_exceeded`,
200
+ `daily_limit_reached`, `catalog_limit_reached`, `key_credit_cap_reached`) are never retried.
201
+ Disable retries with `ValoData(max_retries=0)`.
202
+
203
+ ## Configuration
204
+
205
+ ```python
206
+ ValoData(
207
+ api_key=None, # default: VALO_DATA_API_KEY
208
+ base_url=None, # default: VALO_DATA_BASE_URL or https://api.valotcg.com
209
+ timeout=30.0, # seconds, or an httpx.Timeout
210
+ max_retries=2,
211
+ http_client=None, # your own httpx.Client (AsyncValoData: httpx.AsyncClient)
212
+ )
213
+ ```
214
+
215
+ ## Links
216
+
217
+ - Documentation: [valotcg.com/developers/docs](https://valotcg.com/developers/docs)
218
+ - OpenAPI: [api.valotcg.com/data/v1/openapi.json](https://api.valotcg.com/data/v1/openapi.json)
219
+ (snapshot pinned in [`openapi.json`](openapi.json))
220
+ - Postman: [postman.com/valotcg/valotcg](https://www.postman.com/valotcg/valotcg)
221
+ - MCP server: [github.com/valotcg/valo-ia-mcp](https://github.com/valotcg/valo-ia-mcp)
222
+ - RapidAPI: [rapidapi.com/Stephd91/api/valo-data-trading-card-prices](https://rapidapi.com/Stephd91/api/valo-data-trading-card-prices)
223
+ - Plans: [valotcg.com/developers/pricing](https://valotcg.com/developers/pricing)
224
+
225
+ ## Attribution
226
+
227
+ The terms of use require an attribution wherever the data is shown:
228
+ "Data: [ValoTCG](https://valotcg.com)".
229
+
230
+ ## Contributing
231
+
232
+ See [CONTRIBUTING.md](CONTRIBUTING.md), including how to regenerate the models from the OpenAPI document.
233
+
234
+ ## License
235
+
236
+ MIT, see [LICENSE](LICENSE).
@@ -0,0 +1,207 @@
1
+ # valotcg: Python client for Valo.Data
2
+
3
+ Official Python client for [Valo.Data](https://valotcg.com/developers), the ValoTCG trading card price API:
4
+ catalogue, prices, price history and analysis for 14 TCGs (Pokémon, One Piece, Yu-Gi-Oh!, Magic, Lorcana and more),
5
+ with Cardmarket, US market and eBay sources.
6
+
7
+ - Sync (`ValoData`) and async (`AsyncValoData`) clients on [httpx](https://www.python-httpx.org/)
8
+ - Typed pydantic v2 models generated from the [OpenAPI document](https://api.valotcg.com/data/v1/openapi.json)
9
+ - Credits and request id on every response, typed errors, automatic retry on transient rate limits
10
+ - Cursor pagination helpers
11
+
12
+ Python 3.10 or later.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install valotcg
18
+ # or
19
+ uv add valotcg
20
+ ```
21
+
22
+ ## API key
23
+
24
+ Create a free Sandbox key at [valotcg.com/developers/account](https://valotcg.com/developers/account):
25
+ 500 credits and 250 distinct cards per month, 100 billed requests per day, no credit card.
26
+ Plans and credit costs: [valotcg.com/developers/pricing](https://valotcg.com/developers/pricing).
27
+
28
+ The client reads the key from `api_key=` or from the `VALO_DATA_API_KEY` environment variable and sends it as
29
+ `Authorization: Bearer <key>`.
30
+
31
+ ```bash
32
+ export VALO_DATA_API_KEY=vd_test_...
33
+ ```
34
+
35
+ ## Identify a card, then get its price summary
36
+
37
+ ```python
38
+ from valotcg import ValoData
39
+
40
+ with ValoData() as client:
41
+ found = client.analysis.identify("charizard 4/102", game="pokemon")
42
+ card = found.data.candidates[0].card
43
+ summary = client.analysis.card_summary(card.card_id)
44
+ print(card.name, summary.data.recommended)
45
+ print("credits used:", summary.meta.credits_used, "remaining:", summary.meta.credits_remaining)
46
+ ```
47
+
48
+ ## Batch prices
49
+
50
+ Up to 100 ids per call; sealed products are written `"sealed:<id>"`.
51
+
52
+ ```python
53
+ batch = client.cards.batch([1234, 5678, "sealed:42"])
54
+ for item in batch.data.items:
55
+ if item.status == "ok":
56
+ for quote in item.prices or []:
57
+ print(item.id, quote.source, quote.metric, quote.amount, quote.currency)
58
+ ```
59
+
60
+ ## Pagination
61
+
62
+ Search endpoints return one page and a `next_cursor`. The iterators fetch the next pages lazily
63
+ (each page is a billed request, stop iterating to stop fetching):
64
+
65
+ ```python
66
+ for card in client.cards.iter_search("pokemon", q="pikachu", language="fr"):
67
+ print(card.card_id, card.name)
68
+
69
+ # Any paginated method, sync or async:
70
+ from valotcg import apaginate, paginate
71
+
72
+ for edition in paginate(client.editions.list, "onepiece"):
73
+ print(edition.name)
74
+ ```
75
+
76
+ Available iterators: `cards.iter_search`, `sealed.iter_search`, `editions.iter_list`.
77
+
78
+ ## Async
79
+
80
+ ```python
81
+ import asyncio
82
+ from valotcg import AsyncValoData
83
+
84
+
85
+ async def main() -> None:
86
+ async with AsyncValoData() as client:
87
+ movers = await client.analysis.top_movers("pokemon", period=7, direction="up")
88
+ for mover in movers.data.items:
89
+ print(mover)
90
+ async for card in client.cards.iter_search("lorcana", q="elsa"):
91
+ print(card.name)
92
+
93
+
94
+ asyncio.run(main())
95
+ ```
96
+
97
+ ## Responses
98
+
99
+ Every method returns a `Response[T]`:
100
+
101
+ - `response.data`: the typed model (`valotcg.models`)
102
+ - `response.meta`: `credits_used`, `credits_remaining`, `request_id` (headers `X-Credits-Used`,
103
+ `X-Credits-Remaining`, `X-Request-Id`), plus `rate_limit_limit`, `rate_limit_remaining`,
104
+ `rate_limit_reset`, `status_code` and raw `headers`
105
+ - shortcuts: `response.credits_used`, `response.credits_remaining`, `response.request_id`, and attribute
106
+ access falls through to `.data` (`response.candidates` is `response.data.candidates`)
107
+
108
+ Free routes (`games.list`, `games.rarities`, `usage`) may return no credit headers; the fields are then `None`.
109
+
110
+ ## Routes
111
+
112
+ | Method | HTTP route |
113
+ |---|---|
114
+ | `client.games.list()` | `GET /data/v1/games` |
115
+ | `client.games.rarities(game)` | `GET /data/v1/games/{game}/rarities` |
116
+ | `client.editions.list(game, q=, language=, cursor=, page_size=)` | `GET /data/v1/editions` |
117
+ | `client.cards.search(game, q=, edition_id=, language=, rarity=, cursor=, page_size=)` | `GET /data/v1/cards` |
118
+ | `client.cards.get(card_id)` | `GET /data/v1/cards/{card_id}` |
119
+ | `client.cards.prices(card_id, include=)` | `GET /data/v1/cards/{card_id}/prices` |
120
+ | `client.cards.batch(ids, include=)` | `POST /data/v1/cards/batch` |
121
+ | `client.cards.price_history(card_id, source=, variant=, from_=, to=, market_language=, condition=)` | `GET /data/v1/cards/{card_id}/price-history` |
122
+ | `client.sealed.search(game, q=, edition_id=, product_type=, language=, cursor=, page_size=)` | `GET /data/v1/sealed` |
123
+ | `client.sealed.get(sealed_id)` | `GET /data/v1/sealed/{sealed_id}` |
124
+ | `client.sealed.prices(sealed_id)` | `GET /data/v1/sealed/{sealed_id}/prices` |
125
+ | `client.sealed.price_history(sealed_id, source=, from_=, to=)` | `GET /data/v1/sealed/{sealed_id}/price-history` |
126
+ | `client.analysis.identify(q, game=, language=)` | `GET /data/v1/analysis/identify` |
127
+ | `client.analysis.card_summary(card_id, include=)` | `GET /data/v1/analysis/cards/{card_id}/summary` |
128
+ | `client.analysis.sealed_summary(sealed_id)` | `GET /data/v1/analysis/sealed/{sealed_id}/summary` |
129
+ | `client.analysis.compare(ids, include=)` | `POST /data/v1/analysis/compare` |
130
+ | `client.analysis.top_movers(game, period=, direction=, edition_id=, language=, limit=, reliable=)` | `GET /data/v1/analysis/top-movers` |
131
+ | `client.analysis.top_priced(game, kind=, language=, edition_id=, product_type=, limit=)` | `GET /data/v1/analysis/top-priced` |
132
+ | `client.analysis.edition_overview(edition_id)` | `GET /data/v1/analysis/editions/{edition_id}/overview` |
133
+ | `client.usage(product=)` | `GET /developer/v1/usage` |
134
+
135
+ `from_` maps to the `from` query parameter. `include` accepts a list (`["graded", "population"]`) or a
136
+ comma separated string. Price sources are `cardmarket`, `us_market` and `ebay`.
137
+
138
+ ## Errors
139
+
140
+ Error bodies `{"error": {"code", "message", "request_id", "docs_url"}}` raise typed exceptions, all subclasses
141
+ of `valotcg.ValoDataError` with `status_code`, `code`, `message`, `request_id` and `docs_url`:
142
+
143
+ | Exception | Status | Example codes |
144
+ |---|---|---|
145
+ | `AuthenticationError` | 401 | `invalid_api_key`, `api_key_expired` |
146
+ | `PermissionDeniedError` | 403 | `insufficient_scope`, `plan_feature_unavailable`, `ip_not_allowed` |
147
+ | `NotFoundError` | 404 | `card_not_found`, `sealed_not_found`, `edition_not_found` |
148
+ | `ValidationError` | 400, 422 | `invalid_request`, `invalid_cursor`, `range_exceeds_plan` |
149
+ | `RateLimitError` | 429 | `rate_limited`, `quota_exceeded`, `daily_limit_reached`, `catalog_limit_reached` |
150
+ | `ServerError` | 5xx | `quota_unavailable` |
151
+ | `APIConnectionError` | none | network failure or timeout |
152
+
153
+ `RateLimitError` also carries `retry_after` (seconds, from `Retry-After`) and `resets_at` (when a credit limit
154
+ resets). `valotcg.ValidationError` is distinct from `pydantic.ValidationError`.
155
+
156
+ ```python
157
+ from valotcg import NotFoundError, RateLimitError
158
+
159
+ try:
160
+ client.cards.get(999999999)
161
+ except NotFoundError as exc:
162
+ print(exc.code, exc.request_id)
163
+ except RateLimitError as exc:
164
+ print(exc.code, exc.resets_at)
165
+ ```
166
+
167
+ ### Retries
168
+
169
+ A `429` with code `rate_limited` (or `concurrency_limited`) is retried after `Retry-After` seconds
170
+ (capped at 60), up to `max_retries` times (default 2). Credit limits (`quota_exceeded`,
171
+ `daily_limit_reached`, `catalog_limit_reached`, `key_credit_cap_reached`) are never retried.
172
+ Disable retries with `ValoData(max_retries=0)`.
173
+
174
+ ## Configuration
175
+
176
+ ```python
177
+ ValoData(
178
+ api_key=None, # default: VALO_DATA_API_KEY
179
+ base_url=None, # default: VALO_DATA_BASE_URL or https://api.valotcg.com
180
+ timeout=30.0, # seconds, or an httpx.Timeout
181
+ max_retries=2,
182
+ http_client=None, # your own httpx.Client (AsyncValoData: httpx.AsyncClient)
183
+ )
184
+ ```
185
+
186
+ ## Links
187
+
188
+ - Documentation: [valotcg.com/developers/docs](https://valotcg.com/developers/docs)
189
+ - OpenAPI: [api.valotcg.com/data/v1/openapi.json](https://api.valotcg.com/data/v1/openapi.json)
190
+ (snapshot pinned in [`openapi.json`](openapi.json))
191
+ - Postman: [postman.com/valotcg/valotcg](https://www.postman.com/valotcg/valotcg)
192
+ - MCP server: [github.com/valotcg/valo-ia-mcp](https://github.com/valotcg/valo-ia-mcp)
193
+ - RapidAPI: [rapidapi.com/Stephd91/api/valo-data-trading-card-prices](https://rapidapi.com/Stephd91/api/valo-data-trading-card-prices)
194
+ - Plans: [valotcg.com/developers/pricing](https://valotcg.com/developers/pricing)
195
+
196
+ ## Attribution
197
+
198
+ The terms of use require an attribution wherever the data is shown:
199
+ "Data: [ValoTCG](https://valotcg.com)".
200
+
201
+ ## Contributing
202
+
203
+ See [CONTRIBUTING.md](CONTRIBUTING.md), including how to regenerate the models from the OpenAPI document.
204
+
205
+ ## License
206
+
207
+ MIT, see [LICENSE](LICENSE).