A client for handling Remote Commands (RCON) to a Minecraft server.
Project description
This library provides a straightforward implementation of Minecraft’s Rcon protocol in Python to provide a client for handling Remote Commands (RCON) to a Minecraft server.
Installation
The library is availble on PYPI and can be installed with pip:
pip install mcrcon
Usage
The recommend way to run this client is using the python ‘with’ statement. This ensures that the socket is correctly closed when you are done with it rather than being left open.
Example:
In [1]: from mcrcon import MCRcon In [2]: with MCRcon("10.1.1.1", "sekret") as mcr: ...: resp = mcr.command("/whitelist add bob") ...: print(resp)
While you can use it without the ‘with’ statement, you have to connect manually, and ideally disconnect:
In [3]: mcr = MCRcon("10.1.1.1", "sekret") In [4]: mcr.connect() In [5]: resp = mcr.command("/whitelist add bob") In [6]: print(resp) In [7]: mcr.disconnect()
Command Line Usage
After installing the package a cli will be included that can be used.
Help can be gotten by doing:
mcrcon --help
You can connect from the console with commands like the following:
mcrcon 10.1.1.1
You will either be prompted for your password, or you can set it as follows as an environment variable:
export RCON_PASSWORD=sekret
And then you can run commands on the server interactively:
> /whitelist add bob
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mcrcon-0.6.0.tar.gz
.
File metadata
- Download URL: mcrcon-0.6.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62e5fe014ffd347e7f2e50d92997520607c609a8accf570dbde29b69d8e4ad03 |
|
MD5 | a36b00f6f6a0106771d33021c62ccc6a |
|
BLAKE2b-256 | f5f8d142c6b7b84ed7e3927bc640631317e139784f61f798a17d8b7df29acf4c |