Skip to content

Instantly share code, notes, and snippets.

@ajthemacboy
Created March 18, 2016 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajthemacboy/1d1a73234eeba6632c7c to your computer and use it in GitHub Desktop.
Save ajthemacboy/1d1a73234eeba6632c7c to your computer and use it in GitHub Desktop.
Sucky checker script
from mcstatus import MinecraftServer
with open('serverlist.txt') as f:
for line in f:
# If you know the host and port, you may skip this and use MinecraftServer("example.org", 1234)
server = MinecraftServer.lookup(line)
try:
# 'status' is supported by all Minecraft servers that are version 1.7 or higher.
status = server.status()
print("Server ip: {0}, has {1} players and replied in {2} ms. Version:{3} Motd: {4}".format(line.replace('\n', ' ').replace('\r', ''), status.players.online, status.latency, status.version.name, status.description_clean.encode('utf-8').replace('\n', ' ').replace('\r', '')))
except IOError as e:
print("Could not contact server {0}".format(line.replace('\n', ' ').replace('\r', '')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment