Skip to main content

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

valve-range-query-3-2.0.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

valve_range_query_3-2.0.3-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file valve-range-query-3-2.0.3.tar.gz.

File metadata

  • Download URL: valve-range-query-3-2.0.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.3

File hashes

Hashes for valve-range-query-3-2.0.3.tar.gz
Algorithm Hash digest
SHA256 1d4d3e20186ce295c3ce142bd54ff9b470a0508f8be1142a83c739fbb660fcd9
MD5 b02dc2cea6081196421000edf7069e9c
BLAKE2b-256 75d4d184f487ab4d62774f515f1c483035858051c57b8495d20ad5c7af613e9e

See more details on using hashes here.

File details

Details for the file valve_range_query_3-2.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: valve_range_query_3-2.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.3

File hashes

Hashes for valve_range_query_3-2.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a89bbcc865eb6e4c0bbb511d4f343b429750376b380fa329eba36b67e046ee00
MD5 2d160886a65fe4d90ac572dcef28795f
BLAKE2b-256 2a58fee5d272540bcdde956409acc04a0eeb0c97f2f15fc94afe80f5265217e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page