Skip to main content

A Riot API wrapper specifically for League of Legends.

Project description

pyke

PyPI - Version Documentation

pyke is a thin async Riot API wrapper for League of Legends.

Installation

Install the latest version directly from PyPI:

pip install pyke-lol

You need Python 3.10+


Quickstart

import asyncio

from pyke import Continent, Pyke, exceptions

async def main() -> None:
    # Initialize the API
    async with Pyke("RGAPI-...", timeout=60, print_url=True) as api:
        # Every pyke method follows the same convention as the Riot API
        # For example account/v1/accounts/by-riot-id/{gameName}/{tagLine} becomes:
        account = await api.account.by_riot_id(Continent.EUROPE, "saves", "000")

        print(f"Riot ID: {account['gameName']}#{account['tagLine']}")
        print(f"PUUID:   {account['puuid']}")

        # pyke throws typed exceptions matching Riot API error codes
        try:
            region = await api.account.region_by_puuid(
                Continent.EUROPE, account["puuid"]
            )
        except exceptions.DataNotFound as e:
            print(e)  # Output: Data not found (Error Code: 404)
            quit()

        print(f"Region:  {region['region']}")

Custom Exception Handling

Typed exceptions for all HTTP status codes:

from pyke import exceptions

try:
    summoner = await api.summoner.by_puuid(Region.EUW, "NonExistentPuuid")
except exceptions.DataNotFound as e:
    print(f"Not found: {e}")     # Data not found (Error Code: 404)
except exceptions.RateLimitExceeded as e:
    print(f"Rate limited: {e}")  # Rate limit exceeded (Error Code: 429)
except exceptions.InternalServerError as e:
    print(f"Server error: {e}")  # Internal server error (Error Code: 500)

Resources


For any questions or help, please reach out on Discord: .irm

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-3.2.0.tar.gz (12.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-3.2.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyke_lol-3.2.0.tar.gz
  • Upload date:
  • Size: 12.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-3.2.0.tar.gz
Algorithm Hash digest
SHA256 ad0e4718d95fd53e3ceca1e807f18aa88e811f8dbbaa332ee08ad736965f81a4
MD5 c84ec32b25c4d7d1e53fdc4fe8121974
BLAKE2b-256 0063473d1482d9f3b55c46696591f56886f6b45ed076e284a7c66cecd9c380c4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyke_lol-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.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-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 849d8ec636a74dad3efc0c19a5bc980842e5742870da7f37e8b0cb7e3ba4783f
MD5 a76590b86dcdad47e40e6519ef9e7fdb
BLAKE2b-256 7461aa2291c0981bb0ae31c20ffcd0310533883a5720397966f39a4b6c0ffa9f

See more details on using hashes here.

Provenance

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