Mack's LoL Scout
Debugging dojo

Why is the API mad?

Top fixes when the scout throws shade. The dojo rule: don’t guess. Print one helpful thing, learn one fact, move forward.

Print debugging: your starter kit

print() debugging is just asking questions out loud. If you’re stuck, you need a fact. Prints are how you get facts.

HTTP receipt (copy/paste into your project)

Print the URL and status every time. Print a tiny body slice only on failure.

def print_receipt(url, params, r, *, source='NETWORK'):
  print('SOURCE:', source)
  print('URL:', url)
  print('PARAMS:', params)
  print('STATUS:', r.status_code)
  if r.status_code != 200:
    print('BODY:', r.text[:200])

Nested JSON: the “inspection ladder”

Don’t dive. Take stairs.

print(data.keys())
print(data['info'].keys())
print('participants:', len(data['info']['participants']))

Small, high-signal prints

print(type(x))
print(len(x))
print(list(x.keys())[:10])
print(repr(x)[:200])

The “everything is 403” moment

99% of the time: your dev API key expired (it’s a ~24h key). Regenerate it and rerun Step 02.

401 vs 403

  • 401: missing/invalid auth (wrong header/key)
  • 403: auth present but expired/not allowed

429 rate limit

  • Fetch fewer matches.
  • Add a small sleep + retry.
  • Rely on disk cache for reruns.

Getting [] for match IDs

Usually: wrong routing value for match-v5, or overly strict filters. Print the exact host and URL you’re calling.

One-line self-check

print('HOST CHECK:', base_url)

CSV looks weird

Don’t fix by vibes. Print the table facts.

Pandas sanity prints

print(df.shape)
print(df.dtypes)
print(df.head(5).to_string(index=False))
print('win unique:', sorted(df['win'].dropna().unique().tolist())[:10])
print('game_start min/max:', df['game_start'].min(), df['game_start'].max())

Plot looks like spaghetti

Time plots need sorted time and real datetimes. Plotly is just the messenger. Your dataframe is the message.

Pre-plot checklist (copy/paste)

df = df.sort_values('game_start')
print(df[['game_start', 'win']].head(10).to_string(index=False))
print(df[['game_start', 'win']].tail(10).to_string(index=False))