Python client for the GRID Esports API and ETL helper functions for game data processing
Project description
pygrid
Simple Python based client for the GRID esports API with a collection of data pipeline functions to support processing of game data.
Features / TODO
- Rate limited access to GRID GraphQL endpoints
- Simple client class to access commonly used queries.
- Automatic pagination for queries that require multiple API calls
- Minimal external dependencies; only httpx, pendulum, pydantic and orjson for the client and ariadne-codegen for GraphQL API code generation.
- Release my scripts that parse returned data files ideally in a database agnositic format. As I don't expect this library to become that popular, my main focus will be on compatability with my own ATG database format.
- Complete unit testing coverage of all parsing functions.
- Release on PyPi for easier installation
Installation
pip install git+https://github.com/Allan-Cao/pygrid
Example Usage
Client API key setup
import os
from pygrid.client import GridClient
client = GridClient(os.environ["GRID_API_KEY"])
Lookup series information with filtering
from pygrid import OrderDirection, SeriesType
gte = "2025-01-01T00:00:00.000Z"
tournaments = ["825437", "825439", "825438", "825440", "825441"]
available_series = client.get_all_matches(
order=OrderDirection.DESC,
title_ids = [3], # LoL
gte = gte, # Earliest series time
tournaments = tournaments,
)
Example Series:
GetSeriesAllSeriesEdges(node=GetSeriesAllSeriesEdgesNode(id='2780287', type=<SeriesType.ESPORTS: 'ESPORTS'>, format=GetSeriesAllSeriesEdgesNodeFormat(id='4', name='best-of-5', name_shortened='Bo5'), external_links=[GetSeriesAllSeriesEdgesNodeExternalLinks(data_provider=GetSeriesAllSeriesEdgesNodeExternalLinksDataProvider(description='Riot Esports API', name='LOL'), external_entity=GetSeriesAllSeriesEdgesNodeExternalLinksExternalEntity(id='114058320676724257'))], tournament=GetSeriesAllSeriesEdgesNodeTournament(id='825441', end_date=None, logo_url='https://cdn.grid.gg/assets/tournament-logos/generic', name='NACL - Spring 2025 (Playoffs: Playoffs)', name_shortened='Playoffs', start_date=None), teams=[GetSeriesAllSeriesEdgesNodeTeams(base_info=GetSeriesAllSeriesEdgesNodeTeamsBaseInfo(id='48610', color_primary='#5b6f7e', color_secondary='#ffffff', external_links=[], logo_url='https://cdn.grid.gg/assets/team-logos/389822452c3763a1fca49f66bbab781c', name_shortened=None, name='TBD-1')), GetSeriesAllSeriesEdgesNodeTeams(base_info=GetSeriesAllSeriesEdgesNodeTeamsBaseInfo(id='48611', color_primary='#5b6f7e', color_secondary='#ffffff', external_links=[], logo_url='https://cdn.grid.gg/assets/team-logos/5dd850a9a2c427406c4e68b4c458ec33', name_shortened=None, name='TBD-2'))], start_time_scheduled='2025-06-06T21:00:00Z'))
Generating API code with Ariadne Codegen
Ariadne Codegen lets us translate raw GraphQL queries into a Python library as well as bringing GraphQL's type safety to Python
You'll need to set your GRID API key to be able to access the central data GraphQL API
export GRID_API_KEY=YOUR_KEY_HERE
To regenerate the GraphQL Client code use the following commands
ariadne-codegen client --config central-data.toml
ariadne-codegen client --config series-state.toml
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grid_lol_client-0.2.0.tar.gz.
File metadata
- Download URL: grid_lol_client-0.2.0.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-25-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1adb356e93c6b95f6b3fea2bdf0eafb3165b6ccedcc7912f5c121186798cc35
|
|
| MD5 |
994d4d62155f99cf8368b96ada72aff6
|
|
| BLAKE2b-256 |
c9058b8c42aa374c6470620a3b5c2d7b5542e7004f94bbb98b739b547a941340
|
File details
Details for the file grid_lol_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: grid_lol_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 37.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-25-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05ee557be00cef098ec208df6c060ead296d409392651fb0a99b08092e231b59
|
|
| MD5 |
f4d2f6d9514cef0bf660e2b37d3ec9f9
|
|
| BLAKE2b-256 |
1442a0b94c8d96149da66e8982e00e998dc3585725f036136fba481745576abc
|