Skip to main content

A package for getting Mindustry server status and sending commands.

Project description

pydustry

A Python package for controlling Mindustry servers and getting their current status

Documentation:

pydustry.server(host, server_port = 6567, socketinput_port = 6859)

Server object.

  • host - String. Required. IP address of the server
  • server_port - Int. Defaults at 6567. Port of the server.
  • socketinput_port - Int. Defaults at 6859. Socketinput port of the server.

pydustry.server.get_status()

Returns the status of the server in the form of a dict.

Example:

>>> pydustry.server("exampleserver.com").get_status() will output

{"name": "Example Mindustry server",
 "map": "Maze",
 "players": 5, 
 "wave": 10, 
 "version": 89, 
 "vertype": "official"}
  • "name" - String. Name of the server.
  • "map" - String. Map that the server is currently on.
  • "players" - Int. Number of players online.
  • "wave" - Int. Wave that the server is currently on.
  • "version" - Int. Version that the server is on
  • "vertype" - String. Version type of the server.

pydustry.server.send_command(command) Sends a command through the socketinput port of the server.

  • command - String. Required. Command that gets sent to the server

pydustry.server.get_ping() Returns the delay it takes packets to come to the server and back in miliseconds (ping).

  • ping - Int.

Example codes

import pydustry

# A program that will output the playercount and ping

host = input("Enter the IP address of the Mindustry server:")
port = input("Enter the port of the Mindustry server:")

server = pydustry.server(host, int(port))

playercount = server.get_status()["players"]
ping = server.ping()

print("The number of players is: " + str(playercount))
print("And the ping is: " + str(ping))

import pydustry, time

# A program that will autosave the local server every 5 minutes

server = pydustry.server("localhost")

while True:
    server.send_command("save 0")
    server.send_command("say Saved!")
    time.sleep(300)

Project details


Release history Release notifications

Download files

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

Files for pydustry, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size pydustry-0.0.2-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pydustry-0.0.2.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page