Skip to main content

Simple Python library for querying Quake 3 based principal servers and their game servers

Project description

pyq3serverlist

Simple Python 🐍 library for querying Quake 3 based principal servers and their game servers. Very much based on jacklul's PHP implementation.

Features

  • retrieve a list of game servers from a Quake 3 principal ("master") server
  • supports both UDP (default) and TCP for server list retrieval
  • retrieve status details and current players from game servers

Installation

Simply install the package via pip.

$ pip install pyq3serverlist

Usage

The following example retrieves and prints a game server list for Call of Duty 4: Modern Warfare directly from Activision via UDP.

from pyq3serverlist import PrincipalServer
from pyq3serverlist.exceptions import PyQ3SLError, PyQ3SLTimeoutError

principal = PrincipalServer('cod4master.activision.com', 20810)

try:
    servers = principal.get_servers(6)
    print(servers)
except (PyQ3SLError, PyQ3SLTimeoutError) as e:
    print(e)

You can also directly initialize a game server object for a known server and query its status.

from pyq3serverlist import Server
from pyq3serverlist.exceptions import PyQ3SLError, PyQ3SLTimeoutError

server = Server('198.144.177.2', 27963)
try:
    info = server.get_status()
    print(info)
except (PyQ3SLError, PyQ3SLTimeoutError) as e:
    print(e)

Medal of Honor: Allied Assault, Medal of Honor: Allied Assault Spearhead, Medal of Honor: Allied Assault Breakthrough and Medal of Honor: Pacific Assault all use GameSpy for listing server and support the GameSpy1 query protocol. They do, however, also support a Quake3 protocol variant, which allows queries via the game port.

You can query any known game server for the mentioned Medal of Honor games using MedalOfHonorServer instead of Server.

from pyq3serverlist import MedalOfHonorServer
from pyq3serverlist.exceptions import PyQ3SLError, PyQ3SLTimeoutError

server = MedalOfHonorServer('217.247.241.12', 12203)
try:
    info = server.get_status()
    print(info)
except (PyQ3SLError, PyQ3SLTimeoutError) as e:
    print(e)

You can find a few more examples in the examples folder.

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

pyq3serverlist-0.2.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

pyq3serverlist-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pyq3serverlist-0.2.0.tar.gz.

File metadata

  • Download URL: pyq3serverlist-0.2.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pyq3serverlist-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6344aabb5dc3b93486ad343268657b55ef1999b3586776e7dc02f690f5038cc0
MD5 ffb8bc4f1c3d27bc3f19b542dbc82e3e
BLAKE2b-256 b8ab54d5578090df1786d486047bf553a144b4fd200c1ae1ffc4c47beb23216b

See more details on using hashes here.

File details

Details for the file pyq3serverlist-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyq3serverlist-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pyq3serverlist-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f751b57c251cdb4f5a61d569d20576336eebeef92973baf30961b7e12aef8e5
MD5 d1e42e3c54127c811836af6c5bffd415
BLAKE2b-256 af6744cb0e93b8adfe6617950cab0de779bb26a4a1291d877f0982e602a7a6a0

See more details on using hashes here.

Supported by

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