Skip to main content

Get statuses from Minecraft servers

Project description

mcping Build Badge Docs Badge License Badge

Get statuses from Minecraft servers.

Difference between this and mcstatus

This package uses some classes and functions from mcstatus.

Unlike mcstatus, this package will only attempt to handshake and get the status. It doesn't do any DNS lookups or pings that aren't strictly required to get the status.

This package also doesn't convert the status response into a series of nested classes, which should make the results much easier to work with, especially when dealing with non-standard status responses (eg. Forge mod lists).

A side effect of this is that there isn't any guarantee that the status response will have all of the keys that it should, meaning you'll need to do some validation before assuming that keys are present, or that they're the types you think.

Docs

Documentation is available at https://mcping.readthedocs.io.

Installation

If you want to use the library, install with pip:

pip install mcping

If you only want the CLI, pipx is recommended:

pipx install mcping

Use

Library

import mcping

# Synchronous
mcping.status('127.0.0.1')

# Asynchronous
async def main():
    await mcping.async_status('127.0.0.1')

CLI

The package also includes a CLI to get server statuses. It can be run from a cloned repo using the cli.py file:

python3 cli.py example.com
python3 cli.py example.com:25565

If the library is installed, the mcping script should also be installed and available globally:

mcping example.com
mcping example.com:25565

License

This project is licensed under either of

at your option.

Some code in mcping/__init__.py is modified from the mcstatus project's code, licensed under the Apache License, Version 2.0.

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

mcping-0.2.0.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

mcping-0.2.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

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