Skip to content
Use minecraft's new-fangled Rcon
Python
Branch: master
Clone or download
#1 Compare This branch is 3 commits ahead of CraftySpaz:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore add gitignore and remove unwanted files Apr 15, 2018
COPYING.txt Refine library Apr 15, 2018
README.rst Refine library Apr 15, 2018
mcrcon.py fixed issues with _send rename and __enter__ not returning Apr 15, 2018
setup.py fixed issues with _send rename and __enter__ not returning Apr 15, 2018

README.rst

MCRcon

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()
You can’t perform that action at this time.