rcon package
Submodules
rcon.asyncio module
rcon.client module
Common base client.
- class rcon.client.BaseClient(host: str, port: int, *, timeout: Optional[float] = None, passwd: Optional[str] = None)
Bases:
object
A common RCON client.
- close() None
Close the socket connection.
- connect(login: bool = False) None
Connect the socket and attempt a login if wanted and a password is set.
- login(passwd: str) bool
Perform a login.
- run(command: str, *args: str) str
Run a command.
- property timeout: float
Return the socket timeout.
rcon.config module
RCON server configuration.
- class rcon.config.Config(host: str, port: int, passwd: str | None = None)
Bases:
NamedTuple
Represents server configuration.
- classmethod from_config_section(section: configparser.SectionProxy) rcon.config.Config
Create a credentials tuple from the respective config section.
- classmethod from_string(string: str) rcon.config.Config
Read the credentials from the given string.
- host: str
Alias for field number 0
- passwd: str | None
Alias for field number 2
- port: int
Alias for field number 1
- rcon.config.from_args(args: argparse.Namespace) rcon.config.Config
Get the credentials for a server from the respective arguments.
rcon.console module
An interactive console.
- rcon.console.rconcmd(client_cls: Type[rcon.client.BaseClient], host: str, port: int, passwd: str, *, prompt: str = 'RCON {host}:{port}> ')
Initialize the console.
rcon.errorhandler module
Common errors handler.
rcon.exceptions module
Common exceptions.
- exception rcon.exceptions.ConfigReadError
Bases:
Exception
Indicates an error while reading the configuration.
- exception rcon.exceptions.EmptyResponse
Bases:
Exception
Indicates an empty response from the server.
- exception rcon.exceptions.SessionTimeout
Bases:
Exception
Indicates that the session timed out.
- exception rcon.exceptions.UserAbort
Bases:
Exception
Indicates that a required action has been aborted by the user.
- exception rcon.exceptions.WrongPassword
Bases:
Exception
Indicates a wrong password.
rcon.gui module
rcon.proto module
rcon.rconclt module
RCON client CLI.
- rcon.rconclt.main() int
Run the main script with exceptions handled.
rcon.rconshell module
An interactive RCON shell.
- rcon.rconshell.get_args() argparse.Namespace
Parse and returns the CLI arguments.
- rcon.rconshell.main() int
Run the main script with exceptions handled.
rcon.readline module
Wrapper for readline support.
Module contents
RCON client library.
- class rcon.Client(*args, **kwargs)
Bases:
rcon.source.client.Client
Wrapper for the rcon.source.Client for backwards compatibility.
- exception rcon.EmptyResponse
Bases:
Exception
Indicates an empty response from the server.
- exception rcon.SessionTimeout
Bases:
Exception
Indicates that the session timed out.
- exception rcon.WrongPassword
Bases:
Exception
Indicates a wrong password.
- rcon.rcon(*args, **kwargs) Coroutine[Any, Any, str]
Wrapper for rcon.source.rcon() for backwards compatibility.