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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8f8d5f4d2fbb2430a76b3be5f75dc164049e0b5b3c680196e60581fd0ab565
|
|
| MD5 |
9fcf48d4ed55d70db232039a9c790d66
|
|
| BLAKE2b-256 |
b67072fc79013251d13ca5ea7b1a904ef51a97401c56a1d40b00c7e603a14123
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b82ff25cd92025b4fb5658c133a5f3fee38f54fb0c74ee471877111f8c67662
|
|
| MD5 |
59756150f1435850b242fbcdb556a3d1
|
|
| BLAKE2b-256 |
5da78cab2cc175930bcee83a60fa0a870fa05fff8b03d8104b7e3f422c92a29d
|