This guide walks you through everything you need to go from a blank Python environment to a working Pterodactyl automation script. By the end you will have installed HungerLib, authenticated with your panel, polled live RAM and CPU metrics from a running server, issued power commands, and optionally connected aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/HungerLib/llms.txt
Use this file to discover all available pages before exploring further.
MinecraftServer to a HungerBridge sidecar for TPS and player data.
Install HungerLib
Install HungerLib from PyPI. The package requires Python 3.9 or higher and pulls in Verify the install:
requests, mcrcon, PyYAML, and mapres automatically.Obtain a Pterodactyl API key
HungerLib uses the Pterodactyl Client API, which authenticates with a personal API key scoped to your panel account.
- Log in to your Pterodactyl panel.
- Click your account avatar in the top-right corner and select Account.
- Open the API Credentials tab.
- Click Create New and give the key a descriptive name (e.g.
hungerlib-bot). - Copy the generated key — it starts with
ptlc_and is shown only once.
Connect to the panel
Create a
Panel object with your panel’s base URL and the API key you just copied. Call ping() to verify the connection.Panel also exposes sub-API modules for managing resources on any server:| Attribute | Module |
|---|---|
panel.schedules | Create, update, enable, disable, and run cron schedules |
panel.files | List, upload, download, move, copy, compress, and delete files |
panel.backups | List, create, download, and delete backups |
panel.databases | List, create, rotate passwords, and delete databases |
panel.startup | List and update startup variables |
panel.commands | Send console commands |
Create a GenericServer and check status
GenericServer wraps a single Pterodactyl server identified by its alphanumeric server ID (visible in the panel URL, e.g. https://panel.example.com/server/abc123).gb=True:getStatus() returns one of "running", "offline", "starting", or "stopping". The convenience helpers isOnline() and isOffline() return a plain bool.Power control
GenericServer exposes four power-action shortcuts, each of which returns a (status_code, response_text) tuple.(Optional) MinecraftServer with HungerBridge
If you are running a Minecraft server with the HungerBridge sidecar, use You can also send console commands and in-game broadcasts directly:The raw
MinecraftServer instead of GenericServer. It inherits every method from GenericServer and adds Minecraft-specific features via the embedded BridgeClient.BridgeClient is available at mc.bridge if you need lower-level access.Next Steps
Now that you have a working connection, explore the full API surface:- Panel guide — schedules, file management, backups, databases, and startup variables
- Servers guide — all
GenericServerandMinecraftServermethods in depth - HungerBridge guide — the full
BridgeClientv2 API reference