async-royale-client 1.0.1__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.
- async_royale_client-1.0.1.dist-info/METADATA +74 -0
- async_royale_client-1.0.1.dist-info/RECORD +10 -0
- async_royale_client-1.0.1.dist-info/WHEEL +4 -0
- async_royale_client-1.0.1.dist-info/licenses/LICENSE +674 -0
- clashroyaleapi/__init__.py +10 -0
- clashroyaleapi/client.py +602 -0
- clashroyaleapi/errors.py +58 -0
- clashroyaleapi/models.py +668 -0
- clashroyaleapi/py.typed +0 -0
- clashroyaleapi/transport.py +215 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: async-royale-client
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Typed async Python client for the official Clash Royale REST API
|
|
5
|
+
Project-URL: Homepage, https://github.com/EchterAlsFake/ClashRoyaleAPI
|
|
6
|
+
Project-URL: Documentation, https://docs.echteralsfake.me/clashroyaleapi/
|
|
7
|
+
Project-URL: Issues, https://github.com/EchterAlsFake/ClashRoyaleAPI/issues
|
|
8
|
+
Author-email: Johannes Habel <EchterAlsFake@proton.me>
|
|
9
|
+
License-Expression: GPL-3.0-only
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.12
|
|
15
|
+
Requires-Dist: curl-cffi<1,>=0.13
|
|
16
|
+
Requires-Dist: pydantic<3,>=2.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# ClashRoyaleAPI
|
|
20
|
+
|
|
21
|
+
Typed, async-only Python client for all **30 documented GET endpoints** of the official Clash Royale REST API. Requires Python 3.12+; uses `curl_cffi` and Pydantic v2.
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
pip install async-royale-client
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import asyncio
|
|
29
|
+
import os
|
|
30
|
+
from clashroyaleapi import Client
|
|
31
|
+
|
|
32
|
+
async def main():
|
|
33
|
+
async with Client(os.environ["CLASH_ROYALE_API_TOKEN"]) as client:
|
|
34
|
+
player = await client.get_player("#2VVYYRVYP")
|
|
35
|
+
print(player.name, player.trophies)
|
|
36
|
+
async for card in client.iter_get_cards(limit=100):
|
|
37
|
+
print(card.name)
|
|
38
|
+
|
|
39
|
+
asyncio.run(main())
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Create your own token at https://developer.clashroyale.com and allowlist the public IP making requests. Authentication failures may indicate an IP mismatch rather than an invalid token.
|
|
43
|
+
|
|
44
|
+
[Documentation](https://docs.echteralsfake.me/clashroyaleapi/) · [User guide](docs/guide.md) · [Endpoint reference](docs/endpoints.md) · [Models](docs/models.md)
|
|
45
|
+
|
|
46
|
+
## Behavior
|
|
47
|
+
|
|
48
|
+
- Every network operation is async. Use `async with Client(...)` or `await client.close()`.
|
|
49
|
+
- Individual resources return Pydantic models, paginated endpoints return `Page[T]`, and unpaginated arrays return lists. `iter_<method_name>` methods traverse cursor pages.
|
|
50
|
+
- Models expose snake_case fields and retain unknown fields. `model.to_dict()` exports JSON-compatible data with original API aliases.
|
|
51
|
+
- Up to three attempts for GET requests encountering transport failures, 429, or 5xx. Retry delays are bounded to 30 seconds. Caching is opt-in.
|
|
52
|
+
- Complete endpoint coverage refers to the supplied official documentation snapshot, not a guarantee of upstream availability. Nested model definitions collapsed in that snapshot cannot be exhaustively validated. Deprecated endpoints remain supported.
|
|
53
|
+
|
|
54
|
+
## Development
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
uv sync --locked --python 3.12
|
|
58
|
+
uv run pytest
|
|
59
|
+
uv run ruff check src scripts tests
|
|
60
|
+
uv run mypy
|
|
61
|
+
uv run python scripts/build_docs.py
|
|
62
|
+
uv build
|
|
63
|
+
uv run twine check dist/*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The endpoint manifest is `docs/api-reference.json`. Explicit endpoint methods and response models are generated by `scripts/generate_client.py`; review changes to the manifest and generator before regeneration. Raw browser exports are excluded from Git because they may contain credentials. See [release instructions](docs/releasing.md).
|
|
67
|
+
|
|
68
|
+
## Migration
|
|
69
|
+
|
|
70
|
+
The unfinished `api.api.RoyaleAPI` interface is replaced by `clashroyaleapi.Client`. Add `await` to network calls and use async context management. Replace `get_player_chest_cycle` with `get_player_upcoming_chests` and read `.items`; battle logs are lists from `get_player_battle_log`. Model fields replace the old cached properties and generator accessors: use `player.cards`, `player.clan`, and `player.league_statistics`.
|
|
71
|
+
|
|
72
|
+
## License and affiliation
|
|
73
|
+
|
|
74
|
+
GPL-3.0-only; see LICENSE. This project is unofficial and is not affiliated with, endorsed, sponsored, or approved by Supercell. Supercell is not responsible for its operation or content. Clash Royale trademarks and game content belong to their respective owners.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
clashroyaleapi/__init__.py,sha256=zdTIjMaZO8lckXo4YSG7N-FIvD7gEmYZjgud33zS4WE,294
|
|
2
|
+
clashroyaleapi/client.py,sha256=IAM7kwXgki3Dj5671Ik8bWgK-tFu5vU-KgasERJ_43s,24078
|
|
3
|
+
clashroyaleapi/errors.py,sha256=eVIxLS719uV38Uu-nHZTveS2HZ7Bhw5m-Y9lD77criU,1211
|
|
4
|
+
clashroyaleapi/models.py,sha256=byzXgOUjNqA0XKxzHPda_Vo5mGuEBxe-wQ0LuThZ5dk,27995
|
|
5
|
+
clashroyaleapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
clashroyaleapi/transport.py,sha256=UMwA7pGZ0aJMJMOw51z5kZ4M15HyaiSyFB-oJ5IF3jo,8926
|
|
7
|
+
async_royale_client-1.0.1.dist-info/METADATA,sha256=ZVO4qLiQKD2LfH4gOU5HzlZWBqJkcs3_-vVCoG29X9Q,3739
|
|
8
|
+
async_royale_client-1.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
9
|
+
async_royale_client-1.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
10
|
+
async_royale_client-1.0.1.dist-info/RECORD,,
|