Skip to main content

A Riot API wrapper specifically for League of Legends.

Project description

pyke

pyke is an opinionated, simple-by-design Riot API wrapper specifically for League of Legends.

Installation

Install the latest version directly from PyPI:

pip install pyke-lol

Note: You need Python 3.13+ to use pyke.

Features

  • Provides a simple, pythonic interface to interact with the Riot API.
  • Follows Riot API endpoints and conventions closely.
  • Returns Pydantic models for easy access to API data.
  • Custom exceptions for error handling, e.g., rate limits.

Documentation & Examples

I am currently working on adding documentation

Example Usage

from pyke import Pyke

# We always initialize the API like this
# Check examples/example.py for loading an api key from a .env file
api = Pyke("API_KEY")

# Every pyke method follows the same convention as the Riot API
# For example account/v1/accounts/by-riot-id/{gameName}/{tagLine} becomes the following
account = api.account.by_riot_id(Continent.EUROPE, "saves", "000")

# Every response is a pydantic model whose members can be accessed with dot notation
print(f"Riot ID: {account.game_name}#{account.tag_line}")
print(f"PUUID: {account.puuid}")

# We get access to all the methods that come with a pydantic model
# We can get a json string
print(account.model_dump_json())
# Or a python dictionary
print(account.model_dump())

# pyke throws custom exceptions, again following the same conventions as the Riot API
# For example a request that responds with error code 429
# Will throw pyke.exceptions.RateLimitExceeded
try:
    region = api.account.region_by_puuid(Continent.EUROPE, account.puuid)
except exceptions.RateLimitExceeded as e:
    print(e)  # Output: Rate limit exceeded (Error Code: 429)
    quit()

# Members can be accessed with dot notation just like before
print(f"PUUID: {region.puuid}")
print(f"Game: {region.game}")
print(f"Region: {region.region}")

enjoy :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyke_lol-0.4.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyke_lol-0.4.0-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file pyke_lol-0.4.0.tar.gz.

File metadata

  • Download URL: pyke_lol-0.4.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyke_lol-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4fbe49f459fc5a9877c2fd69569e7043ff0b5f9275bbba79c8c6ea8bb1fb6be1
MD5 927e662ece3fc758b8547041e404d9b9
BLAKE2b-256 10764b40075fc259410e3879c4e89593eb9f8c848b9f25436b52f32c984f9a1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyke_lol-0.4.0.tar.gz:

Publisher: python-publish.yml on diodemusic/pyke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyke_lol-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pyke_lol-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyke_lol-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3f1626d212c749925bfb7bde58286addff30cf43f239e76fa133ddea00ae6ce
MD5 4eea65fa8f9f1e5d1c7220b111fec36c
BLAKE2b-256 73ef120b5d1dd4de0223e3a3cf8a2d54def32fa7cfda3509d97c4004deb352bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyke_lol-0.4.0-py3-none-any.whl:

Publisher: python-publish.yml on diodemusic/pyke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page