rcon.source package¶
Submodules¶
rcon.source.async_rcon module¶
Asynchronous RCON.
- async rcon.source.async_rcon.rcon(command: str, *arguments: str, host: str, port: int, passwd: str, encoding: str = 'utf-8', frag_threshold: int = 4096, frag_detect_cmd: str = '', timeout: int | None = None, enforce_id: bool = True, raise_unexpected_terminator: bool = False) str ¶
Run a command asynchronously.
rcon.source.client module¶
Synchronous client.
- class rcon.source.client.Client(*args, frag_threshold: int = 4096, **kwargs)¶
Bases:
BaseClient
An RCON client.
- communicate(packet: Packet, raise_unexpected_terminator: bool = False) Packet ¶
Send and receive a packet.
- login(passwd: str, *, encoding: str = 'utf-8') bool ¶
Perform a login.
- run(command: str, *args: str, encoding: str = 'utf-8', enforce_id: bool = True, raise_unexpected_terminator: bool = False) str ¶
Run a command.
rcon.source.proto module¶
Low-level protocol stuff.
- class rcon.source.proto.LittleEndianSignedInt32(*_)¶
Bases:
int
A little-endian, signed int32.
- MAX = 2147483647¶
- MIN = -2147483648¶
- async classmethod aread(reader: StreamReader) LittleEndianSignedInt32 ¶
Read the integer from an asynchronous file-like object.
- classmethod read(file: IO) LittleEndianSignedInt32 ¶
Read the integer from a file-like object.
- class rcon.source.proto.Packet(id: LittleEndianSignedInt32, type: Type, payload: bytes, terminator: bytes = b'\x00\x00')¶
Bases:
NamedTuple
An RCON packet.
- async classmethod aread(reader: StreamReader, raise_unexpected_terminator: bool = False) Packet ¶
Read a packet from an asynchronous file-like object.
- id: LittleEndianSignedInt32¶
Alias for field number 0
- payload: bytes¶
Alias for field number 2
- classmethod read(file: IO, raise_unexpected_terminator: bool = False) Packet ¶
Read a packet from a file-like object.
- terminator: bytes¶
Alias for field number 3
- class rcon.source.proto.Type(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
LittleEndianSignedInt32
,Enum
RCON packet types.
- SERVERDATA_AUTH = 3¶
- SERVERDATA_AUTH_RESPONSE = 2¶
- SERVERDATA_EXECCOMMAND = 2¶
- SERVERDATA_RESPONSE_VALUE = 0¶
- rcon.source.proto.random_request_id() LittleEndianSignedInt32 ¶
Generate a random request ID.
Module contents¶
Source RCON implementation.
- class rcon.source.Client(*args, frag_threshold: int = 4096, **kwargs)¶
Bases:
BaseClient
An RCON client.
- communicate(packet: Packet, raise_unexpected_terminator: bool = False) Packet ¶
Send and receive a packet.
- login(passwd: str, *, encoding: str = 'utf-8') bool ¶
Perform a login.
- run(command: str, *args: str, encoding: str = 'utf-8', enforce_id: bool = True, raise_unexpected_terminator: bool = False) str ¶
Run a command.
- async rcon.source.rcon(command: str, *arguments: str, host: str, port: int, passwd: str, encoding: str = 'utf-8', frag_threshold: int = 4096, frag_detect_cmd: str = '', timeout: int | None = None, enforce_id: bool = True, raise_unexpected_terminator: bool = False) str ¶
Run a command asynchronously.