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.
Metadata
Release files for rcon 2.4.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rcon-2.4.9.tar.gz | 45.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rcon-2.4.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.3 kB
Release files / rcon-2.4.9.tar.gz
| Download URL | rcon-2.4.9.tar.gz |
|---|---|
| Size | 45.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d41a8311dc13352da35163f46a3cc13eb20f5cde1297b75b56e7645ef76d0a48
|
|
BLAKE2b-256 checksum How to use checksums |
e445edde086b16cd38591794d328ef62c47f089ac04f32a63b4fcab0981d349a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.7
|
Release files / rcon-2.4.9-py3-none-any.whl
| Download URL | rcon-2.4.9-py3-none-any.whl |
|---|---|
| Size | 31.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0d2477070f189a6b49774133c412473ece40bb452473f160c7373b162dc8929
|
|
BLAKE2b-256 checksum How to use checksums |
69d32668a6e6bd6d66046ebe811f3fac65402620762e31f80b8f88661a7f3e42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.7
|