Skip to main content
By default, Valaw converts API responses into typed Python objects using dataclass-wizard. This gives you attribute access, IDE autocomplete, and type safety. If you’d rather work with plain dictionaries — for example, to forward the response directly to another service — you can enable raw data mode.

Enabling raw data mode

Pass raw_data=True when initializing the client:

Typed vs raw

Typed (default):
Raw:

When to use raw mode

Use raw mode when:
  • You’re forwarding the response directly to another service or API
  • You want the exact JSON structure as Riot returns it
  • You’re debugging and want to inspect the raw response
Use typed mode (default) when:
  • You want IDE autocomplete and type checking
  • You’re building an application that works with the data

Error handling

Error handling works the same in both modes — RiotAPIResponseError is raised regardless.

Serializing to JSON

Raw mode is useful when you want to save the API response directly: