Skip to main content

A utility to query and transform LoL games from QQ and ACS into the LolGame DTO format.

Project description

Code style: black

Leaguepedia Esports Parser

A utility to transform LoL games data from both QQ and ACS into a single Data Transfer Object

This was developed in partnership between T1 and Leaguepedia staff.

Usage

Test can be found in the _tests folder.

import lol_esports_parser

# The package relies on match history URLs
lpl_spring_finals = lol_esports_parser.get_qq_series("http://lol.qq.com/match/match_data.shtml?bmid=6131")
lpl_spring_finals["score"]  # {"JDG": 3, "TES": 2}

lck_spring_finals_g1 = lol_esports_parser.get_riot_game("https://matchhistory.na.leagueoflegends.com/en/#match-details/ESPORTSTMNT03/1353193?gameHash=63e4e6e5d695f410")
lck_spring_finals_g1["winner"]  # "RED"
lck_spring_finals_g1["teams"]["RED"]["name"]  # "T1"

Configuration

Environment variables

Expected environment variables can be found in the template.env file in this repository:

# Queries retries settings
LOL_ESPORTS_PARSER_MAX_RETRIES=2
LOL_ESPORTS_PARSER_RETRY_DELAY=10

# A Riot username and password are required for pro match history
RIOT_USERNAME=xxx
RIOT_PASSWORD=xxx

# A Riot API key is required for amateur matches played on the live server
RIOT_API_KEY=xxx

To load a .env file in python, you can use python-dotenv which offers a very simple syntax to load environment variables with dotenv.load_env().

Alternatively, you can directly use os.environ[key] = value inside your python scripts, but they need to be set before you load lol_esports_parser.

Endpoints configuration and Docker mounting

Endpoints are stored in a file called endpoints.json located at ~/.config/lol_esports_parser.

To access this local file inside of a docker container, you can use this mounting syntax (Windows example):

--mount type=bind, \
        source=C:\Users\USERNAME\.config\lol_esports_parser, \
        target=/usr/.config/lol_esports_parser \

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lol_esports_parser-0.1a8.tar.gz (13.8 kB view hashes)

Uploaded Source

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