Rcon
Python RCON client library
Install / Use
/learn @conqp/RconREADME
Archive note
Since I haven't been using Python in recent years too frequently, I also have not
been working on the issues and necessary fixes to this library.
Therefore I decided to archive this project.
Feel free to fork and continue the project.
If you want to also take over the corresponding project on PyPI, please drop me an email.
rcon
An RCON client implementation.
Requirements
rcon requires Python 3.10 or higher.
Documentation
Documentation is available on readthedocs.
Installation
Install rcon from the AUR or via:
pip install rcon
Quick start
The RCON protocols are used to remotely control game servers, i.e. execute
commands on a game server and receive the respective results.
Source RCON
from rcon.source import Client
with Client('127.0.0.1', 5000, passwd='mysecretpassword') as client:
response = client.run('some_command', 'with', 'some', 'arguments')
print(response)
Async support
If you prefer to use Source RCON in an asynchronous environment, you can use
rcon().
from rcon.source import rcon
response = await rcon(
'some_command', 'with', 'some', 'arguments',
host='127.0.0.1', port=5000, passwd='mysecretpassword'
)
print(response)
BattlEye RCon
from rcon.battleye import Client
with Client('127.0.0.1', 5000, passwd='mysecretpassword') as client:
response = client.run('some_command', 'with', 'some', 'arguments')
print(response)
Handling server messages
Since the BattlEye RCon server will also send server messages to the client alongside command responses, you can register an event handler to process those messages:
from rcon.battleye import Client
from rcon.battleye.proto import ServerMessage
def my_message_handler(server_message: ServerMessage) -> None:
"""Print server messages."""
print('Server message:', server_message)
with Client(
'127.0.0.1',
5000,
passwd='mysecretpassword',
message_handler=my_message_handler
) as client:
response = client.run('some_command', 'with', 'some', 'arguments')
print('Response:', response)
Have a look at rcon.battleye.proto.ServerMessage for details on the
respective objects.
Related Skills
node-connect
336.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.9kCommit, push, and open a PR
