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

Uploaded Python 3

File details

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

File metadata

  • Download URL: q3rconlib-1.0.2.tar.gz
  • Upload date:
  • Size: 5.6 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.2.tar.gz
Algorithm Hash digest
SHA256 f81b9e23b519813ed5c6de7244cc87267e1e55fe02ad10a0780d62331256936d
MD5 7774d3c9544018478c98502ed50c7341
BLAKE2b-256 963acc7b561d6b01a1c371fa21a52b78b06314f6b071c07c52f20bb01fa80b8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for q3rconlib-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: q3rconlib-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2cda435a72936e228f817e7d491fd9dbc96f9873fe2aff6ac90bc62366bad293
MD5 8b79d219ea7f767bf9584a8bd6b586a8
BLAKE2b-256 4942f6262d839fda2f932df99686f3edfd5799fef8e4776430521e29a1d43d87

See more details on using hashes here.

Provenance

The following attestation bundles were made for q3rconlib-1.0.2-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