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, print_rate_limit=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.1.1.tar.gz (12.7 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.1.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyke_lol-3.1.1.tar.gz
  • Upload date:
  • Size: 12.7 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.1.1.tar.gz
Algorithm Hash digest
SHA256 8448823ac4f07c60a1183d8b5483b7d3294f92993ccf5d73fe2916c055f27124
MD5 d350dffd2ba3e97ca8c675289e489af1
BLAKE2b-256 0914a7f8c442698737f88436226a5fc35f2c916616433ffef4dba589db81778a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyke_lol-3.1.1-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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c18be294759a93ba7e50779595a14f7a5fc125934910a1a20c528334b2ac775
MD5 fea9da21aef602da1647ea1ba5a3a8d2
BLAKE2b-256 5e42914903731b9bcddb93a789aceeae7efd0fc0e432665e9a802adc55dba62f

See more details on using hashes here.

Provenance

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