rlstatsapi 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rlstatsapi-0.1.6/src/rlstatsapi.egg-info → rlstatsapi-0.1.7}/PKG-INFO +8 -8
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/README.md +7 -7
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/pyproject.toml +1 -1
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/__init__.py +2 -5
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/__main__.py +15 -8
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/client.py +344 -181
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/config.py +106 -29
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/events.py +3 -5
- rlstatsapi-0.1.7/src/rlstatsapi/models.py +142 -0
- rlstatsapi-0.1.7/src/rlstatsapi/state.py +214 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/types.py +75 -9
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7/src/rlstatsapi.egg-info}/PKG-INFO +8 -8
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/tests/test_client_unit.py +149 -15
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/tests/test_config.py +12 -3
- rlstatsapi-0.1.6/src/rlstatsapi/models.py +0 -92
- rlstatsapi-0.1.6/src/rlstatsapi/state.py +0 -164
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/LICENSE +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/setup.cfg +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi/py.typed +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/SOURCES.txt +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/dependency_links.txt +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/entry_points.txt +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/requires.txt +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/src/rlstatsapi.egg-info/top_level.txt +0 -0
- {rlstatsapi-0.1.6 → rlstatsapi-0.1.7}/tests/test_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rlstatsapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Rocket League Stats API client
|
|
5
5
|
Author: Manuel Cabral
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,15 +22,15 @@ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
|
22
22
|
Requires-Dist: black; extra == "dev"
|
|
23
23
|
Dynamic: license-file
|
|
24
24
|
|
|
25
|
-
<img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/
|
|
25
|
+
<img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/rlstatsapi/blob/main/docs/assets/social-preview.png" />
|
|
26
26
|
|
|
27
27
|
# Rocket League Stats API
|
|
28
|
-
[](https://github.com/psf/black) [](https://pypi.org/project/rlstatsapi/) [](https://github.com/psf/black) [](https://pypi.org/project/rlstatsapi/) [](https://github.com/manucabral/rlstatsapi/actions/workflows/pylint.yml)
|
|
29
29
|

|
|
30
30
|
|
|
31
31
|
`rlstatsapi` is a small Python client for reading live Rocket League Stats API events over a local TCP socket.
|
|
32
32
|
|
|
33
|
-
- Full docs: [manucabral.github.io/
|
|
33
|
+
- Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
|
|
34
34
|
- Release history: [CHANGELOG.md](CHANGELOG.md)
|
|
35
35
|
|
|
36
36
|
## Install
|
|
@@ -44,7 +44,7 @@ pip install rlstatsapi
|
|
|
44
44
|
From GitHub:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
pip install git+https://github.com/manucabral/
|
|
47
|
+
pip install git+https://github.com/manucabral/rlstatsapi.git
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## Rocket League setup
|
|
@@ -127,7 +127,7 @@ def on_goal(msg: EventMessage) -> None:
|
|
|
127
127
|
|
|
128
128
|
## More
|
|
129
129
|
|
|
130
|
-
- Full docs: [manucabral.github.io/
|
|
130
|
+
- Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
|
|
131
131
|
- Examples: [examples/](examples)
|
|
132
132
|
- Release history: [CHANGELOG.md](CHANGELOG.md)
|
|
133
133
|
|
|
@@ -145,6 +145,6 @@ Use this library at your own risk and in compliance with Rocket League’s terms
|
|
|
145
145
|
|
|
146
146
|
## Contributors
|
|
147
147
|
|
|
148
|
-
<a href="https://github.com/manucabral/
|
|
149
|
-
<img src="https://contrib.rocks/image?repo=manucabral/
|
|
148
|
+
<a href="https://github.com/manucabral/rlstatsapi/graphs/contributors">
|
|
149
|
+
<img src="https://contrib.rocks/image?repo=manucabral/rlstatsapi" alt="Contributors" />
|
|
150
150
|
</a>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/
|
|
1
|
+
<img width="600" alt="rlstatsapi-logo" src="https://github.com/manucabral/rlstatsapi/blob/main/docs/assets/social-preview.png" />
|
|
2
2
|
|
|
3
3
|
# Rocket League Stats API
|
|
4
|
-
[](https://github.com/psf/black) [](https://pypi.org/project/rlstatsapi/) [](https://github.com/psf/black) [](https://pypi.org/project/rlstatsapi/) [](https://github.com/manucabral/rlstatsapi/actions/workflows/pylint.yml)
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
`rlstatsapi` is a small Python client for reading live Rocket League Stats API events over a local TCP socket.
|
|
8
8
|
|
|
9
|
-
- Full docs: [manucabral.github.io/
|
|
9
|
+
- Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
|
|
10
10
|
- Release history: [CHANGELOG.md](CHANGELOG.md)
|
|
11
11
|
|
|
12
12
|
## Install
|
|
@@ -20,7 +20,7 @@ pip install rlstatsapi
|
|
|
20
20
|
From GitHub:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
pip install git+https://github.com/manucabral/
|
|
23
|
+
pip install git+https://github.com/manucabral/rlstatsapi.git
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Rocket League setup
|
|
@@ -103,7 +103,7 @@ def on_goal(msg: EventMessage) -> None:
|
|
|
103
103
|
|
|
104
104
|
## More
|
|
105
105
|
|
|
106
|
-
- Full docs: [manucabral.github.io/
|
|
106
|
+
- Full docs: [manucabral.github.io/rlstatsapi](https://manucabral.github.io/rlstatsapi/)
|
|
107
107
|
- Examples: [examples/](examples)
|
|
108
108
|
- Release history: [CHANGELOG.md](CHANGELOG.md)
|
|
109
109
|
|
|
@@ -121,6 +121,6 @@ Use this library at your own risk and in compliance with Rocket League’s terms
|
|
|
121
121
|
|
|
122
122
|
## Contributors
|
|
123
123
|
|
|
124
|
-
<a href="https://github.com/manucabral/
|
|
125
|
-
<img src="https://contrib.rocks/image?repo=manucabral/
|
|
124
|
+
<a href="https://github.com/manucabral/rlstatsapi/graphs/contributors">
|
|
125
|
+
<img src="https://contrib.rocks/image?repo=manucabral/rlstatsapi" alt="Contributors" />
|
|
126
126
|
</a>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Public package surface for rlstatsapi.
|
|
1
|
+
"""Public package interface for ``rlstatsapi``."""
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
helpers so consumers can import from `rlstatsapi` directly.
|
|
6
|
-
"""
|
|
3
|
+
from __future__ import annotations
|
|
7
4
|
|
|
8
5
|
from importlib.metadata import PackageNotFoundError
|
|
9
6
|
from importlib.metadata import version as _pkg_version
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Command-line
|
|
1
|
+
"""Command-line interface for ``rlstatsapi`` configuration and live listening."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -19,14 +19,21 @@ from .config import (
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def main(argv: Sequence[str] | None = None) -> int:
|
|
22
|
-
"""Parse CLI
|
|
22
|
+
"""Parse CLI arguments and run the selected subcommand.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
argv: Optional list of CLI arguments. Defaults to ``sys.argv[1:]``.
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
int: Process exit code.
|
|
29
|
+
"""
|
|
23
30
|
parser = _build_parser()
|
|
24
31
|
args = parser.parse_args(argv)
|
|
25
32
|
return args.func(args)
|
|
26
33
|
|
|
27
34
|
|
|
28
35
|
def _build_parser() -> argparse.ArgumentParser:
|
|
29
|
-
"""
|
|
36
|
+
"""Create the top-level argument parser and register subcommands."""
|
|
30
37
|
parser = argparse.ArgumentParser(prog="rlstatsapi")
|
|
31
38
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
32
39
|
|
|
@@ -88,14 +95,14 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
88
95
|
|
|
89
96
|
|
|
90
97
|
def _run_status(args: argparse.Namespace) -> int:
|
|
91
|
-
"""Print the current TAStatsAPI.ini
|
|
98
|
+
"""Print the current ``TAStatsAPI.ini`` status as formatted JSON."""
|
|
92
99
|
status = get_stats_api_status(args.path)
|
|
93
100
|
print(json.dumps(asdict(status), indent=2))
|
|
94
101
|
return 0
|
|
95
102
|
|
|
96
103
|
|
|
97
104
|
def _run_enable(args: argparse.Namespace) -> int:
|
|
98
|
-
"""Enable the Stats API exporter in TAStatsAPI.ini and print the result."""
|
|
105
|
+
"""Enable the Stats API exporter in ``TAStatsAPI.ini`` and print the result."""
|
|
99
106
|
status = configure_stats_api(
|
|
100
107
|
enabled=True,
|
|
101
108
|
port=args.port,
|
|
@@ -108,7 +115,7 @@ def _run_enable(args: argparse.Namespace) -> int:
|
|
|
108
115
|
|
|
109
116
|
|
|
110
117
|
def _run_disable(args: argparse.Namespace) -> int:
|
|
111
|
-
"""Disable the Stats API exporter in TAStatsAPI.ini and print the result."""
|
|
118
|
+
"""Disable the Stats API exporter in ``TAStatsAPI.ini`` and print the result."""
|
|
112
119
|
status = configure_stats_api(
|
|
113
120
|
enabled=False,
|
|
114
121
|
port=args.port,
|
|
@@ -121,12 +128,12 @@ def _run_disable(args: argparse.Namespace) -> int:
|
|
|
121
128
|
|
|
122
129
|
|
|
123
130
|
def _run_listen(args: argparse.Namespace) -> int:
|
|
124
|
-
"""
|
|
131
|
+
"""Run the async ``_listen`` coroutine from the synchronous CLI handler."""
|
|
125
132
|
return asyncio.run(_listen(args))
|
|
126
133
|
|
|
127
134
|
|
|
128
135
|
async def _listen(args: argparse.Namespace) -> int:
|
|
129
|
-
"""Connect to the local Stats API and
|
|
136
|
+
"""Connect to the local Stats API and print incoming events until interrupted."""
|
|
130
137
|
async with StatsClient(
|
|
131
138
|
host=args.host,
|
|
132
139
|
port=args.port,
|