riotskillissue 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.
- riotskillissue-0.1.0/.github/workflows/publish.yml +36 -0
- riotskillissue-0.1.0/.github/workflows/test.yml +30 -0
- riotskillissue-0.1.0/.github/workflows/update_sdk.yml +50 -0
- riotskillissue-0.1.0/.gitignore +12 -0
- riotskillissue-0.1.0/LICENSE +21 -0
- riotskillissue-0.1.0/PKG-INFO +29 -0
- riotskillissue-0.1.0/README.md +171 -0
- riotskillissue-0.1.0/docs/CONTRIBUTING.md +34 -0
- riotskillissue-0.1.0/pyproject.toml +58 -0
- riotskillissue-0.1.0/src/riotskillissue/__init__.py +5 -0
- riotskillissue-0.1.0/src/riotskillissue/api/__init__.py +0 -0
- riotskillissue-0.1.0/src/riotskillissue/api/client_mixin.py +131 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/account.py +188 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/champion-mastery.py +143 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/champion.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/champion_mastery.py +154 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/clash.py +176 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/league-exp.py +54 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/league.py +226 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/league_exp.py +56 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lol-challenges.py +197 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lol-rso-match.py +124 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lol-status.py +38 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lol_challenges.py +214 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lol_rso_match.py +132 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lol_status.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor-deck.py +65 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor-inventory.py +38 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor-match.py +73 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor-ranked.py +38 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor-status.py +38 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor_deck.py +70 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor_inventory.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor_match.py +78 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor_ranked.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/lor_status.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/match.py +170 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/riftbound-content.py +42 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/riftbound_content.py +44 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/spectator-tft.py +42 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/spectator.py +44 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/spectator_tft.py +44 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/summoner.py +74 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft-league.py +240 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft-match.py +89 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft-status.py +38 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft-summoner.py +69 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft_league.py +260 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft_match.py +94 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft_status.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tft_summoner.py +74 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tournament-stub.py +162 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tournament.py +243 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/tournament_stub.py +176 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val-console-match.py +108 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val-console-ranked.py +54 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val-content.py +42 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val-match.py +104 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val-ranked.py +50 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val-status.py +38 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val_console_match.py +116 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val_console_ranked.py +56 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val_content.py +44 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val_match.py +112 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val_ranked.py +52 -0
- riotskillissue-0.1.0/src/riotskillissue/api/endpoints/val_status.py +40 -0
- riotskillissue-0.1.0/src/riotskillissue/api/models.py +4295 -0
- riotskillissue-0.1.0/src/riotskillissue/auth.py +76 -0
- riotskillissue-0.1.0/src/riotskillissue/cli.py +84 -0
- riotskillissue-0.1.0/src/riotskillissue/core/cache.py +60 -0
- riotskillissue-0.1.0/src/riotskillissue/core/client.py +47 -0
- riotskillissue-0.1.0/src/riotskillissue/core/config.py +19 -0
- riotskillissue-0.1.0/src/riotskillissue/core/http.py +144 -0
- riotskillissue-0.1.0/src/riotskillissue/core/pagination.py +63 -0
- riotskillissue-0.1.0/src/riotskillissue/core/ratelimit.py +185 -0
- riotskillissue-0.1.0/src/riotskillissue/core/types.py +57 -0
- riotskillissue-0.1.0/src/riotskillissue/core/utils.py +25 -0
- riotskillissue-0.1.0/src/riotskillissue/static.py +71 -0
- riotskillissue-0.1.0/src/riotskillissue/testing.py +46 -0
- riotskillissue-0.1.0/tests/conftest.py +11 -0
- riotskillissue-0.1.0/tests/manual_test.py +30 -0
- riotskillissue-0.1.0/tests/test_advanced.py +157 -0
- riotskillissue-0.1.0/tests/test_bindings.py +54 -0
- riotskillissue-0.1.0/tests/test_cache.py +37 -0
- riotskillissue-0.1.0/tests/test_core.py +103 -0
- riotskillissue-0.1.0/tests/test_resiliency.py +64 -0
- riotskillissue-0.1.0/tools/diff_engine.py +149 -0
- riotskillissue-0.1.0/tools/generator/core.py +127 -0
- riotskillissue-0.1.0/tools/generator/parser.py +170 -0
- riotskillissue-0.1.0/tools/manager.py +76 -0
- riotskillissue-0.1.0/tools/templates/client_mixin.py.j2 +11 -0
- riotskillissue-0.1.0/tools/templates/endpoints.py.j2 +48 -0
- riotskillissue-0.1.0/tools/templates/models.py.j2 +22 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
pypi-publish:
|
|
12
|
+
name: Upload release to PyPI
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment:
|
|
15
|
+
name: pypi
|
|
16
|
+
url: https://pypi.org/p/riotskillissue
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.13"
|
|
28
|
+
|
|
29
|
+
- name: Install build tools
|
|
30
|
+
run: pip install hatch
|
|
31
|
+
|
|
32
|
+
- name: Build
|
|
33
|
+
run: hatch build
|
|
34
|
+
|
|
35
|
+
- name: Publish package distributions to PyPI
|
|
36
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "${{ matrix.python-version }}"
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Run Tests
|
|
29
|
+
run: |
|
|
30
|
+
pytest tests/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Update SDK
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 0 * * 0' # Weekly
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
update-sdk:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.13"
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
pip install -e .
|
|
26
|
+
pip install deepdiff rich # Extra dev tools for manager
|
|
27
|
+
|
|
28
|
+
- name: Fetch Spec & Generate Code
|
|
29
|
+
run: |
|
|
30
|
+
python tools/manager.py
|
|
31
|
+
python tools/generator/core.py
|
|
32
|
+
|
|
33
|
+
- name: Check for changes
|
|
34
|
+
id: git-diff
|
|
35
|
+
run: |
|
|
36
|
+
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT
|
|
37
|
+
|
|
38
|
+
- name: Create Pull Request
|
|
39
|
+
if: steps.git-diff.outputs.changes == 'true'
|
|
40
|
+
uses: peter-evans/create-pull-request@v6
|
|
41
|
+
with:
|
|
42
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
43
|
+
commit-message: "feat: update riot api spec"
|
|
44
|
+
title: "feat: Update Riot API Spec"
|
|
45
|
+
body: |
|
|
46
|
+
This PR updates the Riot API SDK based on the latest OpenAPI spec.
|
|
47
|
+
|
|
48
|
+
See the diff report in `reports/` (if generated).
|
|
49
|
+
branch: update-sdk-spec
|
|
50
|
+
base: main
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Demoen
|
|
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,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: riotskillissue
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Production-ready, auto-updating Riot API wrapper.
|
|
5
|
+
Author-email: Antigravity <bot@example.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Requires-Dist: frozendict>=2.4.0
|
|
12
|
+
Requires-Dist: httpx>=0.27.0
|
|
13
|
+
Requires-Dist: jinja2>=3.1.0
|
|
14
|
+
Requires-Dist: msgspec>=0.18.0
|
|
15
|
+
Requires-Dist: pydantic>=2.7.0
|
|
16
|
+
Requires-Dist: redis>=5.0.0
|
|
17
|
+
Requires-Dist: tenacity>=8.2.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: deepdiff>=6.0.0; extra == 'dev'
|
|
20
|
+
Requires-Dist: mypy>=1.10.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: rich>=13.7.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: typer>=0.12.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: types-redis; extra == 'dev'
|
|
29
|
+
Requires-Dist: types-requests; extra == 'dev'
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Riot API Wrapper
|
|
2
|
+
|
|
3
|
+
Production-ready, auto-updating, and fully typed Python wrapper for the Riot Games API.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **100% Coverage**: Auto-generated from the [Official OpenAPI Spec](https://github.com/MingweiSamuel/riotapi-schema). Supports League of Legends, TFT, LoR, and VALORANT.
|
|
8
|
+
- **Type-Safe**: All requests and responses use **Pydantic** models. No more `KeyError` or dictionary guessing.
|
|
9
|
+
- **Resilient**: Built-in **Exponential Backoff**, **Circuit Breakers** (for 5xx), and **Rate Limiting** (Respects `Retry-After`).
|
|
10
|
+
- **Distributed Ready**: Pluggable **Redis Rate Limiting** (Lua Scripted) and **Caching**.
|
|
11
|
+
- **Developer Experience**: Includes **CLI**, **Smart Pagination**, **Data Dragon** helpers, and **Hooks**.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
This package requires **Python 3.8+**.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install from source
|
|
21
|
+
pip install -e .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ⚡ Quickstart
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import asyncio
|
|
30
|
+
from riotskillissue import RiotClient, Region
|
|
31
|
+
|
|
32
|
+
async def main():
|
|
33
|
+
# 1. Initialize Client (Auto-loads RIOT_API_KEY from env)
|
|
34
|
+
async with RiotClient() as client:
|
|
35
|
+
|
|
36
|
+
# 2. Call API (Type-hinted!)
|
|
37
|
+
# Automatically converts "getByPUUID" -> "get_by_puuid"
|
|
38
|
+
summoner = await client.summoner.get_by_puuid(
|
|
39
|
+
region=Region.NA1,
|
|
40
|
+
encryptedPUUID="<YOUR_PUUID>"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
print(f"Level: {summoner.summonerLevel}")
|
|
44
|
+
|
|
45
|
+
# 3. Match History (with Pagination)
|
|
46
|
+
from riotskillissue import paginate
|
|
47
|
+
async for match_id in paginate(client.match.get_ids_by_puuid, puuid=summoner.puuid, count=20):
|
|
48
|
+
print(f"Match: {match_id}")
|
|
49
|
+
|
|
50
|
+
if __name__ == "__main__":
|
|
51
|
+
asyncio.run(main())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🛠 Configuration
|
|
57
|
+
|
|
58
|
+
The client is highly configurable via `RiotClientConfig`.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from riotskillissue import RiotClientConfig, RiotClient
|
|
62
|
+
|
|
63
|
+
config = RiotClientConfig(
|
|
64
|
+
api_key="RGAPI-...", # Or set RIOT_API_KEY env var
|
|
65
|
+
connect_timeout=5.0, # Initial connection timeout (s)
|
|
66
|
+
read_timeout=10.0, # Response read timeout (s)
|
|
67
|
+
max_retries=3, # Max attempts for 5xx/Connectivity errors
|
|
68
|
+
redis_url="redis://localhost" # Enable Distributed Rate Limiting
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Parameter | Type | Default | Description |
|
|
73
|
+
| :--- | :--- | :--- | :--- |
|
|
74
|
+
| `api_key` | `str` | `None` | Riot API Key. Defaults to `os.environ["RIOT_API_KEY"]`. |
|
|
75
|
+
| `redis_url` | `str` | `None` | Connection string for Redis (e.g. `redis://127.0.0.1:6379`). Required for **Distributed Rate Limiting**. |
|
|
76
|
+
| `max_retries` | `int` | `3` | Attempts for network/server errors. |
|
|
77
|
+
| `connect_timeout` | `float` | `5.0` | Headers wait timeout. |
|
|
78
|
+
| `read_timeout` | `float` | `10.0` | Body wait timeout. |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🧠 Advanced Features
|
|
83
|
+
|
|
84
|
+
### 1. Caching
|
|
85
|
+
Reduce API usage by enabling the caching layer.
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from riotskillissue.core.cache import RedisCache, MemoryCache
|
|
89
|
+
|
|
90
|
+
# In-Memory (Single Process)
|
|
91
|
+
cache = MemoryCache()
|
|
92
|
+
|
|
93
|
+
# Redis (Distributed)
|
|
94
|
+
cache = RedisCache("redis://localhost:6379/1")
|
|
95
|
+
|
|
96
|
+
async with RiotClient(cache=cache) as client:
|
|
97
|
+
# 200 OK GET requests are cached automatically (Default TTL: 60s)
|
|
98
|
+
# Static Data is cached longer (versions: 1h, champions: 24h)
|
|
99
|
+
...
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2. Static Data (Data Dragon)
|
|
103
|
+
Auto-fetch champion info without managing version strings.
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# Fetches latest version -> fetches champion.json -> caches it
|
|
107
|
+
annie = await client.static.get_champion(1)
|
|
108
|
+
print(annie["name"]) # "Annie"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Riot Sign-On (RSO)
|
|
112
|
+
OAuth2 helper for web apps.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from riotskillissue.auth import RsoClient, RsoConfig
|
|
116
|
+
|
|
117
|
+
rso = RsoClient(RsoConfig(
|
|
118
|
+
client_id="...",
|
|
119
|
+
client_secret="...",
|
|
120
|
+
redirect_uri="http://localhost/callback"
|
|
121
|
+
))
|
|
122
|
+
|
|
123
|
+
# 1. Redirect user here
|
|
124
|
+
auth_url = rso.get_auth_url()
|
|
125
|
+
|
|
126
|
+
# 2. Exchange code for tokens
|
|
127
|
+
tokens = await rso.exchange_code("authorization_code")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 4. CLI Tool
|
|
131
|
+
Quick debug from terminal.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Basic Lookup
|
|
135
|
+
riotskillissue-cli summoner "Faker#SKT" --region kr
|
|
136
|
+
|
|
137
|
+
# Match Details
|
|
138
|
+
riotskillissue-cli match "KR_1234567890"
|
|
139
|
+
|
|
140
|
+
# Help
|
|
141
|
+
riotskillissue-cli --help
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🧪 Testing
|
|
147
|
+
|
|
148
|
+
This repo comes with a comprehensive test suite.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Run all tests (Unit + Integration + Mocked Edge Cases)
|
|
152
|
+
pytest tests/
|
|
153
|
+
|
|
154
|
+
# Run specific suite
|
|
155
|
+
pytest tests/test_resiliency.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 🤖 Automation
|
|
159
|
+
|
|
160
|
+
How this library stays up to date:
|
|
161
|
+
1. **Weekly Action**: `.github/workflows/update_sdk.yml` runs.
|
|
162
|
+
2. **Fetch**: Downloads `openapi.json` from [MingweiSamuel/riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).
|
|
163
|
+
3. **Diff**: Compares with current generated definitions.
|
|
164
|
+
4. **Generate**: Re-runs `tools/generator/core.py`.
|
|
165
|
+
5. **PR**: Opens a Pull Request with the changes and a changelog.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 📄 License
|
|
170
|
+
|
|
171
|
+
MIT
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development Setup
|
|
4
|
+
|
|
5
|
+
1. Clone the repo.
|
|
6
|
+
2. Install dependencies:
|
|
7
|
+
```bash
|
|
8
|
+
pip install -e ".[dev]"
|
|
9
|
+
pip install httpx pydantic redis tenacity jinja2 frozendict msgspec deepdiff rich typer
|
|
10
|
+
```
|
|
11
|
+
3. Run tests:
|
|
12
|
+
```bash
|
|
13
|
+
pytest
|
|
14
|
+
# Or manual verification
|
|
15
|
+
python tests/manual_test.py
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Code Generation
|
|
19
|
+
|
|
20
|
+
The SDK is generated from the OpenAPI spec. To regenerate:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Fetch latest spec
|
|
24
|
+
python tools/manager.py
|
|
25
|
+
|
|
26
|
+
# Generate code
|
|
27
|
+
python tools/generator/core.py
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Release Process
|
|
31
|
+
|
|
32
|
+
1. **Tag**: Create a new GitHub release with a tag (e.g., `v0.1.0`).
|
|
33
|
+
2. **Publish**: The GitHub Action `.github/workflows/publish.yml` will automatically build and push to PyPI using Trusted Publishing.
|
|
34
|
+
3. **Verify**: Check [PyPI project page](https://pypi.org/p/riot-wrapper).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project.scripts]
|
|
6
|
+
riotskillissue-cli = "riotskillissue.cli:main"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "riotskillissue"
|
|
10
|
+
version = "0.1.0"
|
|
11
|
+
description = "Production-ready, auto-updating Riot API wrapper."
|
|
12
|
+
authors = [{ name = "Antigravity", email = "bot@example.com" }]
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"httpx>=0.27.0",
|
|
16
|
+
"pydantic>=2.7.0",
|
|
17
|
+
"redis>=5.0.0",
|
|
18
|
+
"tenacity>=8.2.0",
|
|
19
|
+
"jinja2>=3.1.0",
|
|
20
|
+
"frozendict>=2.4.0", # For immutable specs
|
|
21
|
+
"msgspec>=0.18.0", # Fast JSON parsing for large specs
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 4 - Beta",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=8.0.0",
|
|
32
|
+
"pytest-asyncio>=0.23.0",
|
|
33
|
+
"pytest-cov>=5.0.0",
|
|
34
|
+
"respx>=0.21.0",
|
|
35
|
+
"ruff>=0.4.0",
|
|
36
|
+
"mypy>=1.10.0",
|
|
37
|
+
"typer>=0.12.0", # For CLI tools
|
|
38
|
+
"rich>=13.7.0", # For pretty CLI output
|
|
39
|
+
"types-redis",
|
|
40
|
+
"types-requests",
|
|
41
|
+
"deepdiff>=6.0.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/riotskillissue"]
|
|
46
|
+
|
|
47
|
+
[tool.mypy]
|
|
48
|
+
strict = true
|
|
49
|
+
ignore_missing_imports = true
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
line-length = 100
|
|
53
|
+
target-version = "py313"
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
asyncio_mode = "auto"
|
|
57
|
+
testpaths = ["tests"]
|
|
58
|
+
python_files = ["test_*.py"]
|
|
File without changes
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Generated Code. Do not edit.
|
|
2
|
+
from riotskillissue.core.http import HttpClient
|
|
3
|
+
|
|
4
|
+
from riotskillissue.api.endpoints.lol_challenges import Lol_challengesApi
|
|
5
|
+
|
|
6
|
+
from riotskillissue.api.endpoints.champion_mastery import Champion_masteryApi
|
|
7
|
+
|
|
8
|
+
from riotskillissue.api.endpoints.clash import ClashApi
|
|
9
|
+
|
|
10
|
+
from riotskillissue.api.endpoints.league_exp import League_expApi
|
|
11
|
+
|
|
12
|
+
from riotskillissue.api.endpoints.league import LeagueApi
|
|
13
|
+
|
|
14
|
+
from riotskillissue.api.endpoints.match import MatchApi
|
|
15
|
+
|
|
16
|
+
from riotskillissue.api.endpoints.champion import ChampionApi
|
|
17
|
+
|
|
18
|
+
from riotskillissue.api.endpoints.lol_rso_match import Lol_rso_matchApi
|
|
19
|
+
|
|
20
|
+
from riotskillissue.api.endpoints.spectator_tft import Spectator_tftApi
|
|
21
|
+
|
|
22
|
+
from riotskillissue.api.endpoints.spectator import SpectatorApi
|
|
23
|
+
|
|
24
|
+
from riotskillissue.api.endpoints.lol_status import Lol_statusApi
|
|
25
|
+
|
|
26
|
+
from riotskillissue.api.endpoints.summoner import SummonerApi
|
|
27
|
+
|
|
28
|
+
from riotskillissue.api.endpoints.tournament_stub import Tournament_stubApi
|
|
29
|
+
|
|
30
|
+
from riotskillissue.api.endpoints.tournament import TournamentApi
|
|
31
|
+
|
|
32
|
+
from riotskillissue.api.endpoints.lor_deck import Lor_deckApi
|
|
33
|
+
|
|
34
|
+
from riotskillissue.api.endpoints.lor_inventory import Lor_inventoryApi
|
|
35
|
+
|
|
36
|
+
from riotskillissue.api.endpoints.lor_match import Lor_matchApi
|
|
37
|
+
|
|
38
|
+
from riotskillissue.api.endpoints.lor_ranked import Lor_rankedApi
|
|
39
|
+
|
|
40
|
+
from riotskillissue.api.endpoints.lor_status import Lor_statusApi
|
|
41
|
+
|
|
42
|
+
from riotskillissue.api.endpoints.riftbound_content import Riftbound_contentApi
|
|
43
|
+
|
|
44
|
+
from riotskillissue.api.endpoints.account import AccountApi
|
|
45
|
+
|
|
46
|
+
from riotskillissue.api.endpoints.tft_league import Tft_leagueApi
|
|
47
|
+
|
|
48
|
+
from riotskillissue.api.endpoints.tft_match import Tft_matchApi
|
|
49
|
+
|
|
50
|
+
from riotskillissue.api.endpoints.tft_status import Tft_statusApi
|
|
51
|
+
|
|
52
|
+
from riotskillissue.api.endpoints.tft_summoner import Tft_summonerApi
|
|
53
|
+
|
|
54
|
+
from riotskillissue.api.endpoints.val_console_ranked import Val_console_rankedApi
|
|
55
|
+
|
|
56
|
+
from riotskillissue.api.endpoints.val_content import Val_contentApi
|
|
57
|
+
|
|
58
|
+
from riotskillissue.api.endpoints.val_console_match import Val_console_matchApi
|
|
59
|
+
|
|
60
|
+
from riotskillissue.api.endpoints.val_match import Val_matchApi
|
|
61
|
+
|
|
62
|
+
from riotskillissue.api.endpoints.val_ranked import Val_rankedApi
|
|
63
|
+
|
|
64
|
+
from riotskillissue.api.endpoints.val_status import Val_statusApi
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class GeneratedClientMixin:
|
|
68
|
+
def __init__(self, http: HttpClient):
|
|
69
|
+
|
|
70
|
+
self.lol_challenges = Lol_challengesApi(http)
|
|
71
|
+
|
|
72
|
+
self.champion_mastery = Champion_masteryApi(http)
|
|
73
|
+
|
|
74
|
+
self.clash = ClashApi(http)
|
|
75
|
+
|
|
76
|
+
self.league_exp = League_expApi(http)
|
|
77
|
+
|
|
78
|
+
self.league = LeagueApi(http)
|
|
79
|
+
|
|
80
|
+
self.match = MatchApi(http)
|
|
81
|
+
|
|
82
|
+
self.champion = ChampionApi(http)
|
|
83
|
+
|
|
84
|
+
self.lol_rso_match = Lol_rso_matchApi(http)
|
|
85
|
+
|
|
86
|
+
self.spectator_tft = Spectator_tftApi(http)
|
|
87
|
+
|
|
88
|
+
self.spectator = SpectatorApi(http)
|
|
89
|
+
|
|
90
|
+
self.lol_status = Lol_statusApi(http)
|
|
91
|
+
|
|
92
|
+
self.summoner = SummonerApi(http)
|
|
93
|
+
|
|
94
|
+
self.tournament_stub = Tournament_stubApi(http)
|
|
95
|
+
|
|
96
|
+
self.tournament = TournamentApi(http)
|
|
97
|
+
|
|
98
|
+
self.lor_deck = Lor_deckApi(http)
|
|
99
|
+
|
|
100
|
+
self.lor_inventory = Lor_inventoryApi(http)
|
|
101
|
+
|
|
102
|
+
self.lor_match = Lor_matchApi(http)
|
|
103
|
+
|
|
104
|
+
self.lor_ranked = Lor_rankedApi(http)
|
|
105
|
+
|
|
106
|
+
self.lor_status = Lor_statusApi(http)
|
|
107
|
+
|
|
108
|
+
self.riftbound_content = Riftbound_contentApi(http)
|
|
109
|
+
|
|
110
|
+
self.account = AccountApi(http)
|
|
111
|
+
|
|
112
|
+
self.tft_league = Tft_leagueApi(http)
|
|
113
|
+
|
|
114
|
+
self.tft_match = Tft_matchApi(http)
|
|
115
|
+
|
|
116
|
+
self.tft_status = Tft_statusApi(http)
|
|
117
|
+
|
|
118
|
+
self.tft_summoner = Tft_summonerApi(http)
|
|
119
|
+
|
|
120
|
+
self.val_console_ranked = Val_console_rankedApi(http)
|
|
121
|
+
|
|
122
|
+
self.val_content = Val_contentApi(http)
|
|
123
|
+
|
|
124
|
+
self.val_console_match = Val_console_matchApi(http)
|
|
125
|
+
|
|
126
|
+
self.val_match = Val_matchApi(http)
|
|
127
|
+
|
|
128
|
+
self.val_ranked = Val_rankedApi(http)
|
|
129
|
+
|
|
130
|
+
self.val_status = Val_statusApi(http)
|
|
131
|
+
|