Skip to main content

A Quake3 RCON interface in Python

Project description

A Quake3 RCON interface in Python

Send rcon commands to Q3 compatible servers.

For an outline of past/future changes refer to: CHANGELOG

Requirements

  • Python 3.11 or greater
  • The game must implement RCON using the Q3 protocol.

Installation

pip install q3rconlib

Use

import os

import q3rconlib


def main():
    with q3rconlib.connect(
        host=os.environ["Q3RCON_HOST"],
        port=int(os.environ["Q3RCON_PORT"]),
        password=os.environ["Q3RCON_PASSWORD"],
    ) as rcon:
        resp = rcon.send("status")
        print(resp)


if __name__ == "__main__":
    main()

q3rconlib.connect(host: str='host', port: int=port, password: str='strongrconpassword')

The Q3Rcon class accepts the following keyword arguments:

  • host: hostname the gameserver resides on
  • port: port the gameserver accepts rcon requests on
  • password: rcon password
  • login_timeout: max timeout for a successful login
  • default_timeout: default amount of time we wait for a response from the game server
  • timeouts: a dict containing cmd: timeout mappings.
    • Some commands take more time to return a response or the response is returned in fragments. You may pass a timeouts dict to specify how long to wait for a given command.

Timeouts

Let's say that that restarting or rotating the map takes a long time, you could pass the following timeouts dict:

timeouts = {
    "map_restart": 1,
    "map_rotate": 1,
}

with q3rconlib.connect(timeouts=timeouts, **config_from_toml()) as rcon:
    """do cool stuff"""

This will cause the program to wait for 1 second for all response fragments to come back from the server.

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

q3rconlib-0.3.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

q3rconlib-0.3.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file q3rconlib-0.3.1.tar.gz.

File metadata

  • Download URL: q3rconlib-0.3.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.7 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for q3rconlib-0.3.1.tar.gz
Algorithm Hash digest
SHA256 10f7cb06de411441470e0c8c2d9a1abab1f3a03511ca1664bf887747ae247cc5
MD5 05d900c12f56de69a44831d2132dcbad
BLAKE2b-256 c673fe1ad2f5b7fe191dac3473a07c85190daf64a13cb84d11e5beb9c2b5e1c2

See more details on using hashes here.

File details

Details for the file q3rconlib-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: q3rconlib-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.7 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for q3rconlib-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc98c78b129cd3976b3e0f33d681da489f2f1aba1d27885cdb8fac89757c0498
MD5 48053d6404520f9270c5733466987a5a
BLAKE2b-256 dbe9b8d0aa66982e2174ab5a9e176832b0ab91b50971dc56a971a47118fbf8ad

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