rcon.battleye package

Submodules

rcon.battleye.client module

BattlEye RCon client.

class rcon.battleye.client.Client(*args, max_length: int = 4096, message_handler: ~typing.Callable[[~rcon.battleye.proto.ServerMessage], None] = <function log_message>, **kwargs)

Bases: BaseClient

BattlEye RCon client.

communicate(request: LoginRequest | CommandRequest | ServerMessageAck) LoginResponse | CommandResponse | ServerMessage | str

Send a request and receive a response.

handle_server_message(message: ServerMessage) None

Handle the respective server message.

login(passwd: str) bool

Log-in the user.

receive() LoginResponse | CommandResponse | ServerMessage

Receive a packet.

receive_transaction()
run(command: str, *args: str) str

Execute a command and return the text message.

rcon.battleye.proto module

Low-level protocol stuff.

class rcon.battleye.proto.CommandRequest(seq: int, command: str)

Bases: NamedTuple

Command packet.

command: str

Alias for field number 1

classmethod from_command(command: str, *args: str) CommandRequest

Create a command packet from the command and arguments.

classmethod from_string(command: str) CommandRequest

Create a command packet from the given string.

property header: Header

Return the appropriate header.

property payload: bytes

Return the payload.

seq: int

Alias for field number 0

class rcon.battleye.proto.CommandResponse(header: Header, seq: int, payload: bytes)

Bases: NamedTuple

A command response.

classmethod from_bytes(header: Header, payload: bytes) CommandResponse

Create a command response from the given bytes.

header: Header

Alias for field number 0

property message: str

Return the text message.

payload: bytes

Alias for field number 2

seq: int

Alias for field number 1

class rcon.battleye.proto.Header(crc32: int, type: int)

Bases: NamedTuple

Packet header.

crc32: int

Alias for field number 0

classmethod create(typ: int, payload: bytes) Header

Create a header for the given payload.

classmethod from_bytes(payload: bytes) Header

Create a header from the given bytes.

type: int

Alias for field number 1

class rcon.battleye.proto.LoginRequest

Bases: str

Login request packet.

property header: Header

Return the appropriate header.

property payload: bytes

Return the payload.

class rcon.battleye.proto.LoginResponse(header: Header, success: bool)

Bases: NamedTuple

A login response.

classmethod from_bytes(header: Header, payload: bytes) LoginResponse

Create a login response from the given bytes.

header: Header

Alias for field number 0

success: bool

Alias for field number 1

class rcon.battleye.proto.ServerMessage(header: Header, seq: int, payload: bytes)

Bases: NamedTuple

A message from the server.

classmethod from_bytes(header: Header, payload: bytes) ServerMessage

Create a server message from the given bytes.

header: Header

Alias for field number 0

property message: str

Return the text message.

payload: bytes

Alias for field number 2

seq: int

Alias for field number 1

class rcon.battleye.proto.ServerMessageAck(seq: int)

Bases: NamedTuple

An acknowledgement of a message from the server.

property header: Header

Return the appropriate header.

property payload: bytes

Return the payload.

seq: int

Alias for field number 0

Module contents

BattlEye RCON implementation.

class rcon.battleye.Client(*args, max_length: int = 4096, message_handler: ~typing.Callable[[~rcon.battleye.proto.ServerMessage], None] = <function log_message>, **kwargs)

Bases: BaseClient

BattlEye RCon client.

communicate(request: LoginRequest | CommandRequest | ServerMessageAck) LoginResponse | CommandResponse | ServerMessage | str

Send a request and receive a response.

handle_server_message(message: ServerMessage) None

Handle the respective server message.

login(passwd: str) bool

Log-in the user.

receive() LoginResponse | CommandResponse | ServerMessage

Receive a packet.

receive_transaction()
run(command: str, *args: str) str

Execute a command and return the text message.

class rcon.battleye.ServerMessage(header: Header, seq: int, payload: bytes)

Bases: NamedTuple

A message from the server.

classmethod from_bytes(header: Header, payload: bytes) ServerMessage

Create a server message from the given bytes.

header: Header

Alias for field number 0

property message: str

Return the text message.

payload: bytes

Alias for field number 2

seq: int

Alias for field number 1