Skip to main content

Python Request Wrapper for Space Engineers Dedicated Server Remote API (VRage API)

Project description

Project generated with PyScaffold

vrage_api

Space Engineers Dedicated Server Remote API in Python

This module is essentially a python wrapper around the requests module to interact with the Space Engineers Dedicated Server Remote API. This module is (will) also be used in a server management tool which provides insight to your server(s). Currently if you run the GUI tool, you can’t get any insight into players that have logged on and played on the server, performance over a period of time, chat logs, existing planets/asteroids and floating objects for example.

Once you have installed the package, you can view some of the example commands in the [examples](./examples/) folder. The example [commands.py](./examples/commands.py) will load a .env file in the root folder, so you can copy the .env-example as .env and fill out the information as required. All non ‘get’ commands will require the –data argument to pass a variable such as EntityId or SteamID. Ensure that you install argparse if you want to test out the commands using this script pip install argparse.

Function endpoint data

GET

get_players <./examples/get/players.json> - Gathers data about all the players such as: SteamID, Display Name, Faction, Faction Level and Ping

get_asteroids <./examples/get/asteroids.json> - Gathers data about all the asteroids in the current session such as: EntityId, position and display name

get_floating_objects <./examples/get/floating_objects.json> - Gathers data about all the floating objects that exist in the current session such as: EntityId, Kind, Position, Mass and Speed

get_grids <./exmaples/get/grids.json> - Gathers data about all the grids that exist in the current session such as: EntityId, Display Name, Position, Mass, Owner SteamID, total amount of PCU, powered status, etc…

get_planets <./examples/get/planets.json> - Gathers data about all the planets that exist in the current session such as: EntityId, Display Name and Position

get_chat <./examples/get/chat.json> - Gathers data about all the chat messages in the current session such as: SteamID, Display Name, Content (Message) and Timestamp

get_server_info <./examples/get/server_info.json> - Gathers data about the server such as: ServerId, Server Name, Total uptime, CPU load, World Name, Version, total amount of Players, total used PCU etc…

get_server_ping<./examples/get/server_ping.json> - Simple healthcheck for the server that responds “Pong” if successful.

get_banned_players <./examples/get/banned_players.json> - Gathers data about all banned players such as:

get_kicked_players <./examples/get/kicked_players.json>

DELETE / BAN / KICK

All delete endpoints will typically just return a HTTP status code of 200 even if the EntityID doesn’t exist…:

{
    "meta": {
        "apiVersion": "1.0",
        "queryTime": 0.1115
    }
}

So some care is required if you really want to identify for example, if a player has actually been kicked/banned properly based on gathering the data after performing a specific action.

A centralized API for multiple servers (and ensuring things like log history, player history) will be linked here directly once developed.

How to use

from vrage_api.vrage_api import VRageAPI

api = VRageAPI(url=”http://localhost:8080”, token=”my-secret-token”) players = api.get_players()

for player in players[“data”][“Players”]:

print(player[“SteamID”], player[“DisplayName”])

if player[“SteamID”] == 12341234567856780:

api.player_ban(steam_id=12341234567856780)

Note

This project has been set up using PyScaffold 4.2.2. For details and usage information on PyScaffold see https://pyscaffold.org/.

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

vrage_api-1.0.2.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vrage_api-1.0.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file vrage_api-1.0.2.tar.gz.

File metadata

  • Download URL: vrage_api-1.0.2.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.0

File hashes

Hashes for vrage_api-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b8a90be2ead7d39a7476a81f99e89f8088fcf4f90c4abe578011098f60b4dc89
MD5 7ec674a6c35be6c30c61f160f9c88a83
BLAKE2b-256 a251cca64d09787a69ddc1d45485f3b6dcf1cc86cc05a8fd965d2604f498a396

See more details on using hashes here.

File details

Details for the file vrage_api-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: vrage_api-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.0

File hashes

Hashes for vrage_api-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d151360322a7955ac1db8ac9dbce0f69af55d20ecfaa6159f0eb332c45ba8d60
MD5 d7ee06166d07e5d6bcb2706698a17e4a
BLAKE2b-256 18b2eefc882f63990f29c6e3632dc52d67c9e755e06df0a32a083e584cbf68f2

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