How to ping a java and bedrock Minecraft server's information with Python

Viewed 597

I'm trying to find a way to ping a Java+Bedrock Minecraft server using python but I couldn't find the right import to use.
I have recently used mcstatus to get the information but now for some reason I don't get a response from the server anymore. I also tried using mcipc but I also couldn't get a response from the server.

Does anybody know of a way to ping a java+bedrock server? (there is a chance I used mcipc wrong, but about mcstatus it worked before the server added the bedrock compatibility plugin).

1 Answers

For Java, you do it like this:

serverdata = 'mc.hypixel.net' #you can add port in like this: mc.hypixel.net/25565 
data = requests.get(f"https://api.minetools.eu/ping/{serverdata}").json()
try:
    print(f"Server is up, and there are {data['players']['online']} players.")
except:  
    print("Server is offline.")

For Bedrock, I have no idea. Sorry about that.

Related