Skip to main content

Minecraft Ping

  • Pings asynchronously Minecraft servers
  • Only gets their Online/Offline boolean
  • Useful to ping a huge list of ips to test for running MC servers.

Sample code / Quickstart

import asyncio

from minecraft_ping import MinecraftPing


async def callback(addr: str, port: int, is_online: bool) -> None:
    # Here handle the server, put it in a json file or anything else.
    print(addr, port, is_online)


async def main() -> None:
    mc_ping: MinecraftPing = MinecraftPing(
        timeout=5,
        callback=callback
    )

    is_online: bool = await mc_ping.get_state('mc.hypixel.net', 25565)
    print(f'The server is {"online" if is_online else "offline"}.')

    servers: set[tuple[str, int]] = {
        ('mc.hypixel.net', 25565),
        ('hub.opblocks.com', 25565),
        ('valheim_is_a_great_game', 123)
    }

    # Here for every server, the callback function will be called.
    await mc_ping.get_state_bulk(servers)

    # If no callback function is provided, default is to write a file with all the online servers.

    # You can modify the default callback output filepath with the `callback_filepath_out`
    # when instantiating MinecraftPing.


if __name__ == '__main__':
    asyncio.run(main())

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minecraft_ping-0.0.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

minecraft_ping-0.0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file minecraft_ping-0.0.3.tar.gz.

File metadata

  • Download URL: minecraft_ping-0.0.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for minecraft_ping-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0a8f8d5f4d2fbb2430a76b3be5f75dc164049e0b5b3c680196e60581fd0ab565
MD5 9fcf48d4ed55d70db232039a9c790d66
BLAKE2b-256 b67072fc79013251d13ca5ea7b1a904ef51a97401c56a1d40b00c7e603a14123

See more details on using hashes here.

File details

Details for the file minecraft_ping-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: minecraft_ping-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for minecraft_ping-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7b82ff25cd92025b4fb5658c133a5f3fee38f54fb0c74ee471877111f8c67662
MD5 59756150f1435850b242fbcdb556a3d1
BLAKE2b-256 5da78cab2cc175930bcee83a60fa0a870fa05fff8b03d8104b7e3f422c92a29d

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 Sentry Error logging StatusPage Status page