Skip to main content

A Riot API wrapper specifically for League of Legends.

Project description

pyke

PyPI - Version Documentation PyPI - Downloads Coverage License: MIT

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


Installation

Install the latest version directly from PyPI:

pip install pyke-lol

Quickstart

from pyke import Continent, Pyke, exceptions

# We always initialize the API like this
# We can explicitly disable url logging, by default pyke will print the url of every call
api = Pyke("API_KEY", print_url=False)

# 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
# For example 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.DataNotFound as e:
    print(e)  # Output: Data not found (Error Code: 404)
    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}")

Note: You need Python 3.9+ to use pyke.


Features

  • Provides a simple, pythonic interface to interact with the Riot API.
  • Smart rate limiting, no wasted calls and no hitting the rate limit (configurable).
  • Optimal api key usage.
  • 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


Contact me

If you run into issues, or just have a question/need help, you can hit me up on discord. my username is .irm

enjoy :)

Pyke Logo

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-1.4.0.tar.gz (27.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-1.4.0-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyke_lol-1.4.0.tar.gz
  • Upload date:
  • Size: 27.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-1.4.0.tar.gz
Algorithm Hash digest
SHA256 d5d7319f2085fc75c16dbe69bb563ddaf88f11023c0ea3cf688386bb1ebf8935
MD5 0f13aadd6bf2ae8ddcf02c7145991127
BLAKE2b-256 44b4512b5272318c7ae8b3b1e5414f5f4cb11afd5cf0c0b90096bab194f6b69b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyke_lol-1.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-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: pyke_lol-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 42.9 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-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 568e5082316f96ee998b0748521095c23e6749929b0e4ae5a2bf7d2b66cadef6
MD5 9f9c893cfc34767ea01e3afb8de5c8de
BLAKE2b-256 b634fa1394d8654e23e7d8d5e09c949ac5394e193423e03eb16d3ea88196e63e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyke_lol-1.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