Python library for Query of Valve Servers over a range of IPs
Project description
This is a Python 3 port of https://github.com/anshulshah96/valve-range-query. It should support all Valve Source Dedicated Servers (CS:GO, TF2, L4D2).
To install the library run
pip3 install valve-range-query-3
To scan servers in range “ <base_ipaddr> . <axlimits> . <aylimits> “
For example scan ‘172’.’25’.’0-34’.’0.254’
from valverangequery import * axlimits = [0,35] aylimits = [0,255] base_ipaddr = "172.25" scanner = SourceScanner(timeout = 20.0, axlimits = axlimits, aylimits = aylimits, base_ipaddr="172.25") server_list = scanner.scan_servers()
To obtain player info from server having IP <ip>
from valverangequery import * ip = "172.25.12.121" player_query = PlayerQuery(ip) player_list= player_query.player()
The respose of SourceScanner is a dictionary of list of servers
Each list entry “server_obj” will have following key-value pairs:
for server_obj in server_list: sample_new_dictionary = { 'map_name' : server_obj['map'], 'host' : server_obj['host_ip'], 'num_players' : server_obj['numplayers'], 'max_players' : server_obj['maxplayers'], 'server_name' : server_obj['name'], 'game_name' : server_obj['game'], 'folder' : server_obj['folder'], 'protocol' : server_obj['protocol'], 'num_bots' : server_obj['bots'], 'num_humans' : server_obj['numplayers'] - server_obj['bots'] }
The respose of PlayerQuery is a dictionary of list of players
Each list entry “player_obj” will have following key-value pairs:
for player_obj in player_list: sample_new_dictionary = { 'score' : player_obj['score'], 'duration' : int(player_obj['duration']) , 'name' : player_obj['name'] }
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
Hashes for valve-range-query-3-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4aa2e5ca3400e49f59e67546aaaee579f557e034425a2dc4a39a3ebbbf54720 |
|
MD5 | 7e4a6d48cc01fec9dfa81b7981ca7a4c |
|
BLAKE2b-256 | 0b944d23d4234d113a9e37cd06746df5f7d0400d6ef61c49a675b6323e627ff4 |
Hashes for valve_range_query_3-2.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd256f9cd66ca3dbec17d44a170ad268eb2f62e12c6e08546bd7c7085704e3fc |
|
MD5 | eceffb135a29962f3a4e6dba34f6e999 |
|
BLAKE2b-256 | d981b47794d829cc28554e5803288f2d123653da0605f3ef7d95ac42762db541 |