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(timeout = 10.0) Returns the delay it takes packets to come to the server and back in miliseconds (ping).

  • ping - Int.
  • timeout - Numeric, optional

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


Download files

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

Source Distribution

pydustry-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file pydustry-0.1.0.tar.gz.

File metadata

  • Download URL: pydustry-0.1.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pydustry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0162f625b1845acaa591cf42b8c80fc8ad3d7299f3fb073939d44ad3125f7507
MD5 474dd1ebe7d5f9fa70f1e5614fe8e426
BLAKE2b-256 efb0e289f2ebc4cfaa18e07030d99d7bc7afc550fbb4fed7d53b88b0fbce35da

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