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 dataclass 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 dataclass 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:

from dataclasses import dataclass

@dataclass
class Timeouts:
    map_restart: int = 1
    map_rotate: int = 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-1.0.0.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.

q3rconlib-1.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: q3rconlib-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 457e4b08d7aa9a3a8008149a2191b3004fb7e504f5fc305d482e555a92c84545
MD5 858c345e794f6cfcdc7c17baab12a28a
BLAKE2b-256 d594223d0b4d012967cd3228ab59bc8cb701dbeb851b37b66673611c74001d51

See more details on using hashes here.

File details

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

File metadata

  • Download URL: q3rconlib-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44be8f457fac08294005e32ac7e3e9bd3929c326bbda279251983fe9973fc672
MD5 cd0009024521c3b22fe32d66dc255217
BLAKE2b-256 fe347d68dc176f6332ac5cda9020f9f06b1c4fdfd39ba8910e9113c1dec9f98b

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