a2squery
توضیحات
A2SQuery is a python implementation of Valve's A2S protocol
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | a2squery-1.2.2 |
| نام | a2squery |
| نسخه کتابخانه | 1.2.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | linKhehe |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/linKhehe/a2squery |
| آدرس اینترنتی | https://pypi.org/project/a2squery/ |
| مجوز | MIT |
A2SQuery [](https://github.com/linKhehe/a2squery/actions/workflows/python-test.yml) [](https://a2squery.readthedocs.io/en/latest/?badge=latest)
==========================================================================================================================================================================================================================================================================================================================================
A2SQuery is a Python implementation of [Valve's A2S protocol](https://developer.valvesoftware.com/wiki/Server_queries).
[View a demo application.](https://a2squery.linkhehe.com)
Docs
----
[View the full A2SQuery documentation here.](https://a2squery.readthedocs.io/en/latest/)
Features
--------
- **Sync and Async Implementations** - Includes fully featured synchronous and `asyncio`-driven networking engines with API parity.
- **Comprehensive API Coverage** - Full protocol implementation spanning the modern Source API and obsolete Source and GoldSource legacy versions.
- Multi-packet batch assembly for split responses across engines.
- Supports BZIP2 compressed responses.
- Handles MTU edge cases for early Source games.
- Catches and discards malformed or unwanted/extra packets.
- **Network Fault Tolerance** - Resilient network I/O.
- Exponential back-off retrying of failed or invalid requests.
- Per-request socket buffer flushing to eliminate cross-request race conditions and overflow.
- Enforces limits on challenge handshakes to prevent infinite handshake loops.
- Saves challenge tokens for faster successive requests.
- **Strict Typing (PEP 561)** - Fully type hinted with `dataclass` response structures.
- **Standard Library Only** - Zero dependencies.
Prerequisites
-------------
- Python >= 3.7
Installation
------------
Install the library via PyPi with
pip install a2squery
Examples
---------------
More [examples available on the docs](https://a2squery.readthedocs.io/en/latest/examples.html).
#### Synchronous
> When using `a2squery.A2SQuery` without a context manager,
remember to call `a2squery.A2SQuery.close()` when finished to close the socket.
```python
from a2squery import A2SQuery
with A2SQuery("127.0.0.1", 27015) as a2s:
print(a2s.info())
# print(a2s.rules())
# print(a2s.players())
# SourceInfo(
# protocol=17, name="Awp Bhop", map="awp_iceworld",
# folder="csgo", game="Counter-Strike: Global Offensive",
# app_id=730, players=43, max_players=64, bots=0,
# server_type=ServerType.Dedicated, environment=Environment.Linux,
# password=False, vac=True, version="1.38.4.4", extra_data_flag=177,
# mode=None, witnesses=None, duration=None,
# port=27015, steam_id=85568392924437989, spectator_port=None,
# spectator_name=None, keywords="awp,bhop,a2squeryiscool", game_id=730
# )
```
#### Asynchronous
> When using `a2squery.AsyncA2SQuery` without a context manager, you will need to call
`a2squery.AsyncA2SQuery.connect()` to start the connection.
Remember to call `a2squery.A2SQuery.close()` when finished to close the socket.
```python
from a2squery import AsyncA2SQuery
async with A2SQuery("127.0.0.1", 27015) as a2s:
print(await a2s.info())
# print(await a2s.rules())
# print(await a2s.players())
# SourceInfo(
# protocol=17, name="Awp Bhop", map="awp_iceworld",
# folder="csgo", game="Counter-Strike: Global Offensive",
# app_id=730, players=43, max_players=64, bots=0,
# server_type=ServerType.Dedicated, environment=Environment.Linux,
# password=False, vac=True, version="1.38.4.4", extra_data_flag=177,
# mode=None, witnesses=None, duration=None,
# port=27015, steam_id=85568392924437989, spectator_port=None,
# spectator_name=None, keywords="awp,bhop,a2squeryiscool", game_id=730
# )
```
Supported Games *(Non-Exhaustive)*
---------------
| App ID | Game | Notes |
|:------:|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| ... | All Half-Life/Half-Life 2 mods and games | |
| 10 | [Counter-Strike 1.6](https://store.steampowered.com/app/10) | |
| 440 | [Team Fortress 2](https://store.steampowered.com/app/440) | |
| 550 | [Left For Dead 2](https://store.steampowered.com/app/550) | |
| 730 | [Counter-Strike: Global Offensive](https://store.steampowered.com/app/730) | |
| 1002 | [Rag Doll Kung Fu](https://store.steampowered.com/app/1002) | |
| 2400 | [The Ship: Murder Party](https://store.steampowered.com/app/2400) | This game has various unique fields on `a2squery.SourceInfo` and `a2squery.Player`. |
| 4000 | [Garry's Mod](https://store.steampowered.com/app/4000) | |
| 17710 | [Nuclear Dawn](https://store.steampowered.com/app/17710) | |
| 70000 | [Dino D-Day](https://store.steampowered.com/app/70000) | |
| 107410 | [Arma 3](https://store.steampowered.com/app/107410) | The query port is the server port + 1. |
| 115300 | [Call of Duty: Modern Warfare 3](https://store.steampowered.com/app/115300) | |
| 211820 | [Starbound](https://store.steampowered.com/app/211820) | |
| 244850 | [Space Engineers](https://store.steampowered.com/app/244850) | The query port is the server port + 1. |
| 304930 | [Unturned](https://store.steampowered.com/app/304930) | The query port is the server port + 1. |
| 251570 | [7 Days To Die](https://store.steampowered.com/app/251570) | |
| 252490 | [Rust](https://store.steampowered.com/app/252490) | |
| 282440 | [Quake Live](https://store.steampowered.com/app/282440) | |
| 346110 | [ARK: Survival Evolved](https://store.steampowered.com/app/346110) | |
| 108600 | [Project: Zomboid](https://store.steampowered.com/app/108600) | |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7.0 | Python |
نحوه نصب
نصب پکیج whl a2squery-1.2.2:
pip install a2squery.whl
نصب پکیج tar.gz a2squery-1.2.2:
pip install a2squery.tar.gz