Skip to main content

A Quake3 RCON interface in Python

Project description

A Quake3 RCON interface in Python

Poetry Ruff

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

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.3.tar.gz (5.7 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.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: q3rconlib-1.0.3.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for q3rconlib-1.0.3.tar.gz
Algorithm Hash digest
SHA256 dd436e83b8af57f8f43ca850b6b3529470e22e6014175b81a763893fed74dffd
MD5 8742ec4004265098c88b74b2edc1b668
BLAKE2b-256 e7a4e6efc6ce8c8c76cf7a34f855a2806c7a333b34a46bb36b77bc406098acd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for q3rconlib-1.0.3.tar.gz:

Publisher: publish.yml on onyx-and-iris/q3rconlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: q3rconlib-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for q3rconlib-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5d4828948d9f237145098d7e2d7dd3e2c6518d225f859cb3f5643ed9753a8d71
MD5 468700a2aff3030cf92e8e1580e4f69c
BLAKE2b-256 6397dde1288bbc5ba546c69f194414ae6146b3824ac631bca9e38291d5f0a5d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for q3rconlib-1.0.3-py3-none-any.whl:

Publisher: publish.yml on onyx-and-iris/q3rconlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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