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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webrcon-1.0.4-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file webrcon-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: webrcon-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for webrcon-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 84ab6b2ed03d3b6d8e40ac47ca3d92a498a704219d17f15bf1f2fd645fe5e152
MD5 e88f0dc915240421435c118d61f0f556
BLAKE2b-256 b272dccb9dac8752db2ff0f0a681ae17e5ed3a8bc39f0bc9726cb6075812d0a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page