Skip to main content

An async Minecraft RCON client library with support for fragmented responses.

Project description

aiomcrcon

Python Versions CodeFactor Grade PyPI - Version PyPI - Downloads

An async Minecraft RCON client library with support for fragmented responses.

Installing

pip install py-aio-mcrcon

Example

import asyncio
import aiomcrcon

async def main():
    # As context manager
    async with aiomcrcon.Client("myserver.com", "password") as client:
        response = await client.command("list")

    # Without context manager
    client = aiomcrcon.Client("myserver.com", "password") # port is optional, default is default RCON port
    await client.connect()
    response = await client.command("list")
    await client.close()

asyncio.run(main())

Documentation

Everything is properly type hinted and documented in the source code. Using the IDE of your choice, you should be able to get all the information you need. Otherwise, just take a look at the source code.

Fragmented responses

The Minecraft server implementation has a limit on the maximum response size of about 4096 bytes. If the response exceeds this limit, it will be split into multiple fragments. The client will automatically reassemble these fragments into a single response.
I do currently not know any other similar library that supports this feature.

Information regarding asyncio.gather()

The client does technically support asyncio.gather(), but in practice it will currently cause errors, because of a bug in the Minecraft server implementation. As long as this bug is not fixed, using the client with asyncio.gather() will execute the first command and return its response, but everything else will be ignored and the connection will be closed by the server. This causes all of the remaining or following commands to time out (raise TimeoutError) or wait indefinitely (based on timeout parameter). The client must be closed and connected to be used again.
This is not a bug in this library, but in the Minecraft server implementation!

Contributing

If you want to contribute to this project, feel free to open a pull request or issue.

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

py_aio_mcrcon-1.0.1.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

py_aio_mcrcon-1.0.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file py_aio_mcrcon-1.0.1.tar.gz.

File metadata

  • Download URL: py_aio_mcrcon-1.0.1.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for py_aio_mcrcon-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b6b5ee73b2b9d82dac49ed50d7555c0c17745b3d03c4dff8475f8cc030cf02e1
MD5 bed217a2114909e09b4d0d027771d05e
BLAKE2b-256 64dbf835e0d3e4bc23ee013c946c288c5e05191ea8d1c26464e8fc97d6b855f7

See more details on using hashes here.

File details

Details for the file py_aio_mcrcon-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: py_aio_mcrcon-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for py_aio_mcrcon-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d49d494983c35a71d4ff08eba676f99ebcffc04580be9798933803443013de
MD5 a478d45008fced5f1b49e1c72badba3f
BLAKE2b-256 619af1a7bec4af49a2a271dc45acd6afd7ea5ec6c3c73f2377c26484c47efb29

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