Download champion data (static)
Fetch champion metadata once (basic + detailed), save it locally, and build a friendly lookup.
Run after each small change. Tiny loops win.
uv run python -m src.scout src/scout/(your fetch code)data/ddragon/
30–60 minutes
Do this (suggested order)
- Install the HTTP library:
uv add requests. - Fetch the Data Dragon versions list and pick the newest version string.
- Download
champion.jsonfor that version (and a language likeen_US). - Download
championFull.jsonfor the same version/lang (this has spells, tags, lore, etc.). - Save them to
data/ddragon/champion.jsonanddata/ddragon/champion_full.json. - Build a small lookup file (whatever mapping you like) and save
data/ddragon/champ_lookup.json.
You’ll practice
- Install a lib with uv
- Make HTTP requests with requests
- Save + load JSON cleanly
Explainers (for context, not homework)
- Caching sanity — Why “save files” is the whole strategy
- uv + dependencies — Fix “No module named requests” fast
Build
- requests
- Download champion.json (basic) for a chosen version/lang
- Download championFull.json (detailed) for the same version/lang
- Save both under data/ddragon/
- Build champ_lookup.json (key→name mapping you like)
Check yourself
- Script prints how many champions loaded (basic + detailed)
- Shows three example mappings like “266 -> Aatrox”
If it breaks
- Forgetting to create data/ddragon/
- Writing Python dict repr instead of JSON
- Using the wrong ddragon endpoint
Hints (spoilers)
Hint: versions endpoint (grab it, don’t guess it)
Data Dragon has a “versions” endpoint that returns a list. Pick the first entry (newest) and use it for the champion file URL.
Receipt prints that prevent guessing
print('VERSIONS URL:', url)
r = requests.get(url)
print('STATUS:', r.status_code)
versions = r.json()
print('NEWEST:', versions[0]) Bigger hint: URL shape (print it before you fetch it)
The champion list URL looks like: ddragon.leagueoflegends.com/cdn/<version>/data/<lang>/champion.json. If you can print the exact URL, you can fix 90% of bugs.
URL you’re aiming for
https://ddragon.leagueoflegends.com/cdn/<version>/data/<lang>/champion.json The “all champs, but detailed” version is the same URL shape with a different filename:
Detailed file URL
https://ddragon.leagueoflegends.com/cdn/<version>/data/<lang>/championFull.json Unblock-me: “I saved it but it looks weird” (JSON vs Python repr)
If your file contains single quotes or looks like {'key': 'value'}, you accidentally
wrote the Python representation, not real JSON.
The save/load pattern (the safe one)
import json
with open('data/ddragon/champion.json', 'w', encoding='utf-8') as f:
json.dump(data, f, indent=2)
with open('data/ddragon/champion.json', 'r', encoding='utf-8') as f:
data = json.load(f) Unblock-me: docs rabbit hole guardrail
Riot docs → League of Legends → Data Dragon. Find “versions” and “champion.json”. Don’t go down the
per-champion JSON rabbit hole yet. You only need champion.json and championFull.json
right now.
Just this one for now. Keep the backpack light.
uv add requests Expected files
data/
ddragon/
champion.json
champion_full.json
champ_lookup.json URL shape you’re aiming for
https://ddragon.leagueoflegends.com/cdn/<version>/data/<lang>/champion.json URL shape (detailed)
https://ddragon.leagueoflegends.com/cdn/<version>/data/<lang>/championFull.json “Loaded 168 champions. 266 → Aatrox | 412 → Thresh | 875 → Sett”.