This repository was archived by the owner on Dec 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
28 lines (23 loc) · 5.67 KB
/
setup.py
File metadata and controls
28 lines (23 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['csotools_serverquery',
'csotools_serverquery.common',
'csotools_serverquery.connection']
package_data = \
{'': ['*']}
setup_kwargs = {
'name': 'csotools-serverquery',
'version': '0.6.0',
'description': 'Query GoldSource and CSO servers for server info, players and more',
'long_description': '# csotools-serverquery\n\nLibrary to query GoldSource & CSO servers.\n\nImplements [Valve\'s Server Query Protocol](https://developer.valvesoftware.com/wiki/Server_queries).\n\nForked from [python-a2s v1.3.0](https://github.com/Yepoleb/python-a2s),\nwhich is also rewrite of the [python-valve](https://github.com/serverstf/python-valve) module.\n\nSupports both synchronous and asyncronous applications.\n\n## Requirements\n\nPython >=3.7, no external dependencies\n\n## Install\n\n`pip3 install csotools-serverquery` or `python3 setup.py install`\n\n## API\n\n### Functions\n\nSynchronous:\n* `csotools_serverquery.info(...)`\n* `csotools_serverquery.players(...)`\n* `csotools_serverquery.rules(...)`\n* `csotools_serverquery.ping(...)`\n\nAsynchronous:\n* `csotools_serverquery.ainfo(...)`\n* `csotools_serverquery.aplayers(...)`\n* `csotools_serverquery.arules(...)`\n* `csotools_serverquery.aping(...)`\n\n### Exceptions\n\n* `csotools_serverquery.BrokenMessageError(Exception)` - General decoding error.\n* `csotools_serverquery.BufferExhaustedError(BrokenMessageError)` - Response too short.\n* `socket.timeout` - No response (synchronous calls).\n* `asyncio.exceptions.TimeoutError` - No response (async calls).\n* `socket.gaierror` - Address resolution error.\n* `ConnectionRefusedError` - Target port closed.\n* `OSError` - Various networking errors like routing failure.\n\n## Examples\n\nExample output shown may be shortened.\n\n```py\n>>> import csotools_serverquery as a2s\n>>> address = ("129.226.150.30", 27116)\n\n>>> a2s.info( address )\nSourceInfo(protocol=48, server_name=\'[sorpack.com]116丧尸升级服(Asia.Best)\', map_name=\'de_dust2\', folder=\'cstrike\', game=\'Biohazard\', app_id=10, player_count=3, max_players=32, bot_count=2, server_type=\'d\', platform=\'w\', password_protected=False, vac_enabled=False, version=\'1.1.2.7/Stdio\', edf=145, port=27116, steam_id=90071992547409920, stv_port=None, stv_name=None, keywords=None, game_id=10, ping=0.07799999999406282)\n\n>>> a2s.info( address )\nGoldSrcInfo(address=\'127.0.0.1:27116\', server_name=\'[sorpack.com]116丧尸升级服(Asia.Best)\', map_name=\'de_dust2\', folder=\'cstrike\', game=\'Biohazard\', player_count=3, max_players=32, protocol=47, server_type=\'D\', platform=\'W\', password_protected=False, is_mod=True, vac_enabled=False, bot_count=2, mod_website=\'\', mod_download=\'\', mod_version=1, mod_size=0, multiplayer_only=True, uses_custom_dll=False, ping=0.031000000002677552)\n\n>>> import asyncio\n\n>>> asyncio.run( a2s.ainfo(address) )\nGoldSrcInfo(address=\'127.0.0.1:27116\', server_name=\'[sorpack.com]116丧尸升级服(Tpo.love)\', map_name=\'de_dust2\', folder=\'cstrike\', game=\'Biohazard\', player_count=3, max_players=32, protocol=47, server_type=\'d\', platform=\'w\', password_protected=False, is_mod=True, vac_enabled=False, bot_count=2, mod_website=\'\', mod_download=\'\', mod_version=1, mod_size=0, multiplayer_only=True, uses_custom_dll=False, ping=0.046000000002095476)\n\n>>> address = ("169.254.250.246", 40008) #CSN:S Turkey server\n>>> a2s.info( address, mutator_cls=a2s.connection.CSOStreamMutator )\nGoldSrcInfo(address=\'169.254.250.246:40008\', server_name=\'[TR]Come get some.\', map_name=\'cs_italy\', folder=\' �\\x19\', game=\'Counter-Strike\', player_count=7, max_players=9, protocol=47, server_type=\'D\', platform=\'W\', password_protected=False, is_mod=True, vac_enabled=False, bot_count=6, mod_website=\'www.counter-strike.net\', mod_download=\'\', mod_version=1, mod_size=184000000, multiplayer_only=False, uses_custom_dll=False, ping=0.21800000000803266)\n```\n\n## Notes\n\n* Some servers return inconsistent or garbage data. Filtering this out is left to the specific application, because there is no general approach to filtering that makes sense for all use cases. In most scenarios, it makes sense to at least remove players with empty names. Also the `player_count` value in the info query and the actual number of players returned in the player query do not always match up.\n\n* For some games, the query port is different from the actual connection port. The Steam server browser will show the connection port and querying that will not return an answer. There does not seem to be a general solution to this problem so far, but usually probing port numbers up to 10 higher and lower than the connection port usually leads to a response. There\'s also the option of using `http://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr={IP}` to get a list of game servers on an IP (thanks to Nereg for this suggestion). If you\'re still not successful, use a network sniffer like Wireshark to monitor outgoing packets while refreshing the server popup in Steam.\n\n* Player counts above 255 do not work and there\'s no way to make them work. This is a limitation in the specification of the protocol.\n\n* This library does not implement rate limiting. It\'s up to the application to limit the number of requests per second to an acceptable amount to not trigger any firewall rules.\n\n## Tested Games\n\nHalf-Life, Counter-Strike 1.6, Counter-Strike Nexon : Studio\n\n## License\n\nMIT\n',
'author': 'AnggaraNothing',
'author_email': 'anggarayamap@protonmail.com',
'maintainer': None,
'maintainer_email': None,
'url': None,
'packages': packages,
'package_data': package_data,
'python_requires': '>=3.7',
}
setup(**setup_kwargs)