Rocket League Stats API client
Project description
RL Stats API
rlstatsapi is a simple and fast Python client for reading live Rocket League Stats API events over a local TCP socket.
Install
From PyPI:
pip install rlstatsapi
From GitHub (latest main):
pip install git+https://github.com/manucabral/RocketLeagueStatsAPI.git
Rocket League setup
Before launching Rocket League, edit:
<Install Dir>\TAGame\Config\DefaultStatsAPI.ini
Use at least:
PacketSendRate=30(any value> 0enables the exporter)Port=49123
Restart the game after changing the file.
Quick start
import asyncio
import logging
from rlstatsapi import StatsClient
logging.basicConfig(level=logging.INFO)
async def main() -> None:
client = StatsClient(log_enabled=True)
client.on_any(lambda msg: print(msg.event, msg.data))
await client.connect()
try:
await asyncio.Event().wait()
finally:
await client.disconnect()
asyncio.run(main())
Example Event (Goals)
import asyncio
from rlstatsapi import StatsClient
from rlstatsapi.models import EventMessage
from rlstatsapi.types import GoalScoredPayload, cast_event_data
async def on_goal(msg: EventMessage) -> None:
data: GoalScoredPayload = cast_event_data("GoalScored", msg.data)
scorer = data.get("Scorer", {})
print("Goal by:", scorer.get("Name"))
async def main() -> None:
client = StatsClient()
client.on("GoalScored", on_goal)
await client.connect()
try:
await asyncio.Event().wait()
finally:
await client.disconnect()
asyncio.run(main())
Public API
StatsClient(...)connect()/disconnect()on(event_name, handler)on_any(handler)events()- typed helpers:
EventName,TypedEventMessage[...],cast_event_data(...)
Notes
- Works for regular matches. Some fields like
MatchGuidare only present in online/LAN contexts. - In current builds this endpoint may behave as plain TCP JSON stream instead of websocket upgrade. This library handles the TCP stream format.
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
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 rlstatsapi-0.1.2.tar.gz.
File metadata
- Download URL: rlstatsapi-0.1.2.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2844544af8f1c629731b4ec27f89cf7c038f7ee7a36afed32b21aa7ba4996e4
|
|
| MD5 |
88cda37cae26ef3e4e0abc9a2dd0a38d
|
|
| BLAKE2b-256 |
a5cd02ba78ef3551fc533d57fb5522549e322787ca0c2fa8e44dbe0f1d16f52c
|
File details
Details for the file rlstatsapi-0.1.2-py3-none-any.whl.
File metadata
- Download URL: rlstatsapi-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3548f38a5f9919508d2c56ce3e813afb911a80f7753a2a987a303b546e2d4b6
|
|
| MD5 |
d450d5812990f4cb90694233a96c4fd9
|
|
| BLAKE2b-256 |
6c9172a2f16b94c0ef53349b42091ca439aefe6be7c066c631fd2be596c7f818
|