Skip to main content

Basic async interface for Rust's WebRcon protocol

Project description

WebRcon Package

Install

pip install webrcon
or
pip install https://github.com/lewdneko/webrcon/archive/master.zip

Docs

webrcon.RconConnector(host, port, password, message_callback=None, console_callback=None)

Initialises the class
host: str - the IP/hostname of the server accepting WebRcon
port: Union[str, int] - the port the server is accepting WebRcon on
password: str - the password used to connect over WebRcon
message_callback: func - a sync or async function that is called whenever a chat message is sent
console_callback: func - a sync or async function that is called whenever a console message is sent

await RconConnector.start(loop, **kwargs)

Opens a connection to the server
loop - an asyncio event loop, can be obtained through asyncio.get_event_loop()
kwargs - passed to websockets.client.connect - read the docs

await RconConnector.close()

Closes the connection to the server

await RconConnector.command(command, callback)

Sends a command over RCON to the server
command: str - The command you want to be sent to the server
callback: func - A sync/async function that should take a single argument. The passed value will be a dict consisting of the output from the RCON server.
The response to your command will be under the Message key.

webrcon.InvalidServer

Your host/port/password combination is incorrect or the server isn't running.

webrcon.ConnectionClosed

You closed the connection and still tried to send a command. Good one.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for webrcon, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size webrcon-1.1.0.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page