LPDB_python provides Python interfaces for the Liquipedia Database API (LPDB API).
- Python 3.12 or later
- API key for LPDB
- (Optional) aiohttp
pip install lpdb_pythonPython wrapper for LPDB session is defined in session.py. The wrapper provides the following differences from making your own requests:
-
Type hints
-
Validation of data type names being requested
If an invalid data type is supplied, then the session will raiseValueErrorbefore attempting to make a request. -
Error / warning handling
If an error is returned by LPDB, then they will be converted to and raised as a Python exception. -
Pre-configured request header, including formatting of your API key in the request header
import lpdb_python as lpdb # These are equivalent session = lpdb.LpdbSession("your_lpdb_api_key") session = lpdb.LpdbSession("Apikey your_lpdb_api_key")
Asynchronous implementation of LPDB session can be found in async_session/session.py. This implementation depends on aiohttp, which can be installed with this library with the following command:
pip install lpdb_python[async]Data types in LPDB can be found in https://liquipedia.net/commons/Help:LiquipediaDB.
The raw data returned from LPDB may not be in the corresponding Python types. To help easily access the data, defs.py file provides wrappers for each available data types that offers converted data as object properties.
A property provided by the wrapper may be None if the raw data passed to the constructor of the wrapper
did not contain the data, or if it contained an empty string. Thus, the user should be checking for None
where appropriate.
import lpdb_python as lpdb
session = lpdb.LpdbSession("your_lpdb_api_key")
matches = [
lpdb.Match(lpdb_raw_match)
for lpdb_raw_match in session.make_request(
"match",
"leagueoflegends",
conditions="[[parent::World_Championship/2025]]",
streamurls="true",
)
]Documentation for this package can be found in GitHub Pages.
This library is licensed under the MIT License, unless otherwise stated in the header of a file.
It should be noted, however, that the data you will be fetching from LPDB API is licensed under CC BY-SA 3.0.
See Liquipedia API Terms of Use here.
"Liquipedia" is a registered trademark of Team Liquid. Liquipedia does not endorse or sponsor this project.