Skip to main content

Blitzcrank

PyPi Downloads

Riot API made easy

Intoduction

Welcome to Blitzcrank, a module to help with interaction with the Riot API. Although there are many modules like it, most simply act as wrappers to the Riot API without providing much useful functionality. The aim of this project is to make access to the Riot API as painless as possible, while still allowing the richness of data it provides.

While Blitzcrank is easy to use, if you're new to Python or programming in general, take a look at this guide first and familiarise yourself with Python in general before attempting to use this module. A more well rounded foundation will make it easier for you to grow. This four hour seminar is suitable for complete programmming beginners.

Features

  • Built in (custom) rate limiting
  • Extra tooling for quick extraction of match data (see Built in indexing below)
  • Coverage of all base API endpoints the Riot API provides
  • Champion/Item APIs to allow built in querying of champion and item IDs, names and statistics

Installation

  • Install blitzcrank using pip

    pip install blitzcrank

  • Import from the same directory level using

    from blitzcrank import Blitzcrank

Getting started

Here's a sample of using Blitzcrank to get base player information;

from blitzcrank import Blitzcrank

b = Blitzcrank('RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'euw1')
b.summoner.by_name('Montagne')

>> {'id': '5-u_LoLzSaKwdrnG9vK35E8Ju27IXVu6XMM2Y38pxIfhjwM', 
    'accountId': 'igL1_xtGwMyfW89c9EFvok3_yvOGrBOjeosOxL2WtzCg2X4', 
    'puuid': 'k3uFuLaNZplggr93emIb9W3JP0Gf_1D-3vUKt4Bd8m78I1RXiKvvDslyJ53fdbO7zJsN405siJDQPA', 
    'name': 'Montagne', 
    'profileIconId': 691, 
    'revisionDate': 1581790964000, 
    'summonerLevel': 118}

For most methods, a summoner name or account ID is needed;

from blitzcrank import Blitzcrank

b = Blitzcrank('RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'euw1')
s = b.summoner.by_name('Montagne')
b.league.rank_by_summoner_id(s['id'])

>> [{'leagueId': '717ffd55-1b41-4197-bf31-afeafa6346bc', 
    'queueType': 'RANKED_SOLO_5x5', 
    'tier': 'SILVER', 
    'rank': 'I', 
    'summonerId': '5-u_LoLzSaKwdrnG9vK35E8Ju27IXVu6XMM2Y38pxIfhjwM', 
    'summonerName': 'Montagne', 
    'leaguePoints': 39, 
    'wins': 88, 
    'losses': 82, 
    'veteran': True, 
    'inactive': False, 
    'freshBlood': False, 
    'hotStreak': False}]

Built in indexing

When analysing data, a lot of time is taken making sure you've prefixed correctly according to the Riot Documentation. Blitzcrank lets you rocket grab statistics in simple one liners.

from blitzcrank import Blitzcrank
import json

b = Blitzcrank("RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "euw1")

summoner = "Thebausffs"
summoner_id = b.summoner.by_name(summoner).get('accountId')
match_id = b.match.matchlist_by_account(summoner_id, queues=[420])['matches'][0]['gameId']

game_data = b.match.by_id(match_id)
timeline_data = b.match.timeline_by_id(match_id)

stats_array = []

for participant in range(1,11):
    participant_stats = {
        "summoner": b.summoner.by_account(b.match.account_id_for_participant(participant, game_data))["name"],
        "champion": b.match.champion_for_participant(participant, game_data),
        "opposing_champion": b.match.lane_opponent_for_participant(participant, game_data, timeline_data),
        "csdiff@15": b.match.csdiff_at_15_for_participant(participant, game_data, timeline_data),
        "cs_per_min": b.match.cs_per_min_for_participant(participant, game_data),
        "golddiff@15": b.match.golddiff_at_15_for_participant(participant, game_data, timeline_data),
        "gold_per_min": b.match.gold_per_min_for_participant(participant, game_data),
        "control_wards_placed": b.match.control_wards_placed_for_participant(participant, timeline_data)
    }

    stats_array.append(participant_stats)

print(json.dumps(stats_array, sort_keys=True, indent=4))

You can find more examples of usage within the examples directory.

Note

A lot of the examples utilise pandas, a helpful library for dealing with tables of information. Once data is saved within pandas into a CSV format, it can be easily copy/pasted into google sheets, or various other locations where scouting reports may be held.

Rate limiting

Blitzcrank will by default use the developer API key rate limits. You can change these such as in this example below;

from blitzcrank import Blitzcrank

b = Blitzcrank("RGAPI-10ec71d4-32b7-464b-a75d-9ce28708f6c7", "euw1")
b.change_rate_limits(short_call_limit=500, short_call_period=10, =long_call_limit30000, long_call_period=600)

There is a more verbose rate limit example in the examples directory, as well as a test.

Feature request and collaboration

If you'd like to request a feature, please make an issue on this repository with the title starting "FR". e.g

"FR: Query Riot API for my future"

If you're a developer, and you spot anything that you think can be improved within blitzcrank, you are more than welcome to open up a pull request with your desired changes. Any changes which can be well justified, will be implemented.

To do's

  • Extended documentation of each method (in-line or otherwise)
  • Demo video including projects created with Blitzcrank

Metadata

Release files for blitzcrank 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blitzcrank 0.0.5
File Size Uploaded Provenance Actions
blitzcrank-0.0.5.tar.gz 13.3 kB Without provenance Details for blitzcrank-0.0.5.tar.gz

Release files / blitzcrank-0.0.5.tar.gz

Download URL blitzcrank-0.0.5.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1a20b13ce7098c9d73dbc654d955b5df877eebcb845e026c4a3b38dd85ef1a86
BLAKE2b-256 checksum
How to use checksums
d5815477792a681a7f37d6b17ccf9e8bd5bae88e51c121b7b23e62d48d7aa50e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.0

Security for blitzcrank 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page