Skip to main content

Holistic Python implementation of the public Riot Games Developer API.

Project description

🔎 Overview

gromp is a holistic wrapper of the public Riot Games developer API, written in Python. All public methods are, as of 2023-11-10, implemented.

The core principle of the wrapper is to offer a complete, yet simple, interface which implements some of the core functionality that a developer might want to communicate with the Riot Games developer API.

For a full list of all available requests, see each respective endpoint documentation.

🔑 Requirements

  • To perform requests you need an API key from Riot Games, get yours here.

📦 Installation

Either clone this repository and perform a local install with poetry accordingly

git clone https://github.com/wilhelmagren/gromp.git
cd gromp
poetry install

or install the most recent release from the Python Package Index (PyPI).

pip install gromp

🚀 Example usage

Any HTTP errors that are returned by the requested API are propagated and, as of writing this, not handled.

import gromp
from gromp import (
    LeaguePlatforms,
    LeagueRegions,
)

platform = LeaguePlatforms.euw1
region = LeagueRegions.EUROPE
token = '<api-key>'

# Here we setup a hook for League of Legends. We specify platform and region
# to perform all REST requests to, the length of the RSA keys used to encrypt
# our token, and the number of seconds to wait before a timeout.
hook = gromp.hook.League(
    token,
    platform=platform,
    region=region,
    keylen=1024,
    timeout=10,
)

# One of the default handlers parses the HTTP response as a JSON
# dictionary, see all available attributes for the object at the
# Riot Games API documentation https://developer.riotgames.com/apis
summoner = hook.summoner.by_name('1 900 976 JUICE')

# We can also get the summoner if we know the encrypted
# puuid, lets try and see if they are actually the same...
summoner_from_puuid = hook.summoner.by_puuid(summoner['puuid'])

assert summoner == summoner_from_puuid

# Great, we get the same summoner, me. Let's try and get
# some of my played games from the match API endpoint.
matches = hook.match.matchlist_by_puuid(
    summoner['puuid'],
    start=10,
    count=5,
)

assert len(matches) == 5

# Now we can request the match data for all the match id's which we
# got from the previous request. This is unfortunately the only 
# process of getting specific match data... it is rather tedious.
for match_id in matches:
    m = hook.match.by_id(match_id)
    for participant in m['info']['participants']:
        if participant['puuid'] == summoner['puuid']:
            print(participant['win'])

💡 Gromp facts

His real name is Lord Grompulus Kevin Ribbiton of Croaksworth, and he likes to eat small insects, mushrooms, and people (source).

📋 License

All code is to be held under a general MIT license, please see LICENSE for specific information.

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

gromp-1.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

gromp-1.1.0-py3-none-any.whl (93.3 kB view details)

Uploaded Python 3

File details

Details for the file gromp-1.1.0.tar.gz.

File metadata

  • Download URL: gromp-1.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.0 Linux/6.2.0-1015-azure

File hashes

Hashes for gromp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 94f9dd4f5272f389e011df7b674acf3039d5cd4b06315b0768a7e27b2a0bbd08
MD5 08d57e78bd0c06e54fcd0301f361ef36
BLAKE2b-256 cd22f68ac0324ec190b5b3366baf9f5993db7eb56e201edffd165699df2366a9

See more details on using hashes here.

File details

Details for the file gromp-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: gromp-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 93.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.0 Linux/6.2.0-1015-azure

File hashes

Hashes for gromp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ad5e2d579bf323155ebfc325e39dd1971871b36d8ac93e7182d3438930b6849
MD5 e717985521b553f45ff6ea776ad4f1df
BLAKE2b-256 73e8ffa25e5ea813eb8038de81a8917976833fb61c80544d46c06865e8d119c4

See more details on using hashes here.

Supported by

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