Skip to main content

A library to query Minecraft Servers for their status and capabilities.

Project description

travis build status current version supported python versions

mcstatus

mcstatus provides an easy way to query Minecraft servers for any information they can expose. It provides three modes of access (query, status and ping), the differences of which are listed below in usage.

Usage

from mcstatus import MinecraftServer

# If you know the host and port, you may skip this and use MinecraftServer("example.org", 1234)
server = MinecraftServer.lookup("example.org:1234")

# 'status' is supported by all Minecraft servers that are version 1.7 or higher.
status = server.status()
print("The server has {0} players and replied in {1} ms".format(status.players.online, status.latency))

# 'ping' is supported by all Minecraft servers that are version 1.7 or higher.
# It is included in a 'status' call, but is exposed separate if you do not require the additional info.
latency = server.ping()
print("The server replied in {0} ms".format(latency))

# 'query' has to be enabled in a servers' server.properties file.
# It may give more information than a ping, such as a full player list or mod information.
query = server.query()
print("The server has the following players online: {0}".format(", ".join(query.players.names)))

Command Line Interface

$ mcstatus
Usage: mcstatus [OPTIONS] ADDRESS COMMAND [ARGS]...

  mcstatus provides an easy way to query Minecraft servers for any
  information they can expose. It provides three modes of access: query,
  status, and ping.

  Examples:

  $ mcstatus example.org ping
  21.120ms

  $ mcstatus example.org:1234 ping
  159.903ms

  $ mcstatus example.org status
  version: v1.8.8 (protocol 47)
  description: "A Minecraft Server"
  players: 1/20 ['Dinnerbone (61699b2e-d327-4a01-9f1e-0ea8c3f06bc6)']

  $ mcstatus example.org query
  host: 93.148.216.34:25565
  software: v1.8.8 vanilla
  plugins: []
  motd: "A Minecraft Server"
  players: 1/20 ['Dinnerbone (61699b2e-d327-4a01-9f1e-0ea8c3f06bc6)']

Options:
  -h, --help  Show this message and exit.

Commands:
  json    combination of several other commands with json formatting
  ping    prints server latency
  query   detailed server information
  status  basic server information

Installation

mcstatus is available on pypi, and can be installed trivially with:

python3 -m pip install mcstatus

Alternatively, just clone this repo!

License

mcstatus is licensed under Apache 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

mcstatus-4.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

mcstatus-4.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file mcstatus-4.1.0.tar.gz.

File metadata

  • Download URL: mcstatus-4.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for mcstatus-4.1.0.tar.gz
Algorithm Hash digest
SHA256 0ce08e4e394dc7a4011f362066f939c919f374967b28ee2ff158f68a5d171aa9
MD5 a173ff0a92044b1380022350bdabb978
BLAKE2b-256 ae63d41f327610b722ab3bea50fb287ddc2720bd717d9f7533dc53f85b728137

See more details on using hashes here.

File details

Details for the file mcstatus-4.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcstatus-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 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.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for mcstatus-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71b72d4bf7009ed01a17d706288e0cae8260b777052064b5948d55d3a9752e47
MD5 9c144cf52395cbfa2fe685b09220fbbe
BLAKE2b-256 fd44c6730f1f74d33d269ee8bb485dbe5fb66fbd16c5b49718d77dcbee6d7230

See more details on using hashes here.

Supported by

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