Skip to main content

A Python framework for accessing League of Legends esports data

Project description

Hextech

A Python framework for accessing League of Legends esports data. This package uses data from Leaguepedia and Riot's Data Dragon API. It does not require the use of a Riot API key.

Installation

With pip:

pip install hextech

Usage

Here is a basic example of using hextech to print the winners of each game in LCK 2020 Summer split.

import hextech

tournament = hextech.getTournaments()["LKC 2020 Summer"]
matches = tournament.getMatches()
for match in matches:
	games = match.getGames()
	for game in games:
		print(game.teams[game.winner])

Objects of the following classes are meant to be read-only; they are automatically instantiated by methods such as tournament.getMatches() and match.getGames().

Functions

The definitions of the framework's base functions. The functions take in parameters that act as filters for data selection. Some filters are required while others are optional. More detailed descriptions of the filters can be found in the source code.

Filters support equality operators (=, !=, >, <, >=, <=) e.g. tournamentDate=">2019-08-21" returns all tournaments with dates greater than 2019-08-21

Filters can be either single values e.g. tournamentName="LCK 2020 Summer" or iterables e.g. tournamentLeague=["LCK", "LCS"]

For iterable filters (lists/tuples), the type determines whether AND/OR will be applied Lists will apply OR to filter elements e.g. tournamentDate=["2019-08-21", ">2020-01-01"] will return tournaments with tournamentDate = 2019-08-21 OR tournamentDate > 2020-01-01 Tuples will apply AND to filter elements (this is useful for applying tournamentDate range filters) e.g. tournamentDate=(">2019-08-21", "<=2019-12-01") will return tournaments with dates between 2019-08-21 AND 2019-12-01

These functions are used by other classes e.g. Tournament.getMatches() calls the base getMatches() function with the filter tournamentName

getTeams(
	tournamentName: str/List[str]/Tuple(str) # required
) -> List[str]

getTournaments(
	tournamentLeague: str/List[str]/Tuple(str), # optional (if not specified, use default leagues)
	tournamentName: str/List[str]/Tuple(str), # optional
	tournamentDate: str/List[str]/Tuple(str) # optional
) -> Dict[str -> Tournament]

getMatches(
	tournamentName: str/List[str]/Tuple(str), # optional
    matchDate: str/List[str]/Tuple(str) # optional
    matchPatch: str/List[str]/Tuple(str) # optional
    matchTeam: str/List[str]/Tuple(str) # optional
) -> List[Match]

Tournament Class

A league specific collection of matches within a specified time frame (e.g. LCK 2020 Summer).

name: str
startDate: str # format yyyy-mm-dd
league: str

getMatches() -> Dict[str -> Match]

Match Class

A series of games between two teams. There could be one or multiple games in a match.

_uniqueMatch: str # for internal use
_uniqueGames: List[str] # for internal use

dateTime: str # format yyyy-mm-dd hh:mm:ss
patch: str
teams: Tuple(str, str)
scores: Tuple(int, int)

getGames(retrieveImages: bool) -> List[Game] 

retrieveImages is false by default. If retrieveImages is true, the assets variable in the Scoreline objects get populated by data from the data dragon api.

Game Class

_uniqueGame: str # for internal use

gameName: str
dateTime: str # format yyyy-mm-dd hh:mm:ss
duration: str # format hh:mm
matchHistory: str # link to Riot's match history page for this game

winner: int # corresponding with the index (zero-based) of the winning team
teams: Tuple(str, str)
bans: Tuple(str, str)
scoreboard: [ 
	List[Scoreline],
	List[Scoreline]
] 

getScoreline(teamIndex: int, roleIndex: int) -> Scoreline

The scoreboard variable contains Scoreline variables for each role on each team. The list is indexed such that scoreboard[0] and scoreboard[1] correspond to team 1 and 2 respectively; and scoreboard[i][0] -> top ... scoreboard[i][4] -> support.

Scoreline Class

Represents the stats for a given player for a specific game.

_uniqueGame: str # for internal use
player: Player

role: str
champion: str

kills: int
deaths: int
assists: int
gold: int
cs: int

summonerSpells: List[str]
items: List[str]
runes: str

assets: Dict[str -> str] # dictonary mapping name of object (e.g. Blade of the Ruined King) to it's thumbnail url

Player Class

name: str
team: str
thumbnail: str # url to the player's thumbnail image

Issue Reporting

If you find a bug, please open a new issue.

Changelog

v1.0.2 - 8/10/2020

Added integration with Riot's Data Dragon api to retrieve champion, item, and summoner spell images.

Disclaimer

Hextech isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.

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

hextech-1.0.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hextech-1.0.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file hextech-1.0.3.tar.gz.

File metadata

  • Download URL: hextech-1.0.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for hextech-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1f9d4302bdb3eebae2fd8dfcd146ae7f43165be1005b679fa5bc50997b1c5fec
MD5 8786ae61e9edb871e1f89c6493a762d2
BLAKE2b-256 031aef9bd06ba594f11d6ab69f17031eef8c7f42f44acacfdf9f1ca64fcb53d1

See more details on using hashes here.

File details

Details for the file hextech-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: hextech-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for hextech-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 35123d6d7ba6be55b3348288a5085fb8f9ca5d9eae988d9cc6a26fbc8dfa9e86
MD5 a54f773c9af5b5788c0c68b5fc0a78f2
BLAKE2b-256 444bbc26d4e7185d8a11cdd4b7010e9691877a9388cdef2a63ae1eb33d6ee490

See more details on using hashes here.

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