Skip to main content

Documentation 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.

Panel is the top-level entry point for all communication with a Pterodactyl panel. It wraps the Pterodactyl Client API, handles authentication headers, and exposes thin HTTP primitives (get, post, delete, patch) that every other HungerLib class builds on. Instantiate one Panel per panel instance and pass it into your server objects.
from hungerlib import Panel

panel = Panel(
    name="production",
    url="https://panel.example.com",
    api_key="ptlc_xxxxxxxxxxxxxxxxxxxx",
)

if panel.ping():
    print("Panel is reachable")

Constructor

Panel(name: str, url: str, api_key: str)
name
str
required
A human-readable label for this panel instance. Used in logging and __str__ output — not sent to the API.
url
str
required
Base URL of the Pterodactyl panel, e.g. https://panel.example.com. Trailing slashes are stripped automatically.
api_key
str
required
Pterodactyl Client API key (starts with ptlc_). Passed as a Bearer token on every request.

Properties

headers

@property
panel.headers -> dict
Returns the standard authentication and content-type headers used on every request. You typically do not need to call this directly — all HTTP methods attach it automatically. Returns dict:
{
  "Authorization": "Bearer ptlc_xxxx",
  "Accept": "application/json",
  "Content-Type": "application/json"
}

Health Checks

ping()

panel.ping() -> bool
Performs a lightweight GET /api/client request to verify that the panel is reachable and responsive. Catches all network-level exceptions internally and returns False instead of raising. Returns boolTrue if the panel responds with HTTP 200, False for any error or non-200 status.
if not panel.ping():
    print("Panel is unreachable")

validateAPI()

panel.validateAPI() -> bool
Calls GET /api/client/account to verify that the configured API key is valid and has the necessary account-level permissions. Returns boolTrue if the response is HTTP 200 (key is valid), False otherwise.
if not panel.validateAPI():
    raise RuntimeError("Invalid or expired API key")

HTTP Primitives

These methods are thin wrappers around requests and are used internally by every API sub-module. You can call them directly for custom endpoint access.

get()

panel.get(path: str, timeout: int = 5) -> requests.Response
path
str
required
API path to append to the base URL, e.g. "/api/client/servers".
timeout
int
default:"5"
Request timeout in seconds.
Returns requests.Response.

post()

panel.post(path: str, json: dict | None = None, timeout: int = 5) -> requests.Response
path
str
required
API path to POST to.
json
dict | None
default:"None"
JSON-serialisable dict to send as the request body.
timeout
int
default:"5"
Request timeout in seconds.
Returns requests.Response.

delete()

panel.delete(path: str, timeout: int = 5) -> requests.Response
path
str
required
API path to send the DELETE request to.
timeout
int
default:"5"
Request timeout in seconds.
Returns requests.Response.

patch()

panel.patch(path: str, json: dict | None = None, timeout: int = 5) -> requests.Response
path
str
required
API path to PATCH.
json
dict | None
default:"None"
JSON-serialisable dict to send as the request body.
timeout
int
default:"5"
Request timeout in seconds.
Returns requests.Response.

_raw_upload()

panel._raw_upload(url: str, file_data) -> requests.Response
Sends a multipart POST request for file uploads. Unlike the other HTTP methods, this call only attaches the Authorization header (no Content-Type), allowing requests to set the multipart boundary automatically.
url
str
required
API path for the upload endpoint.
file_data
dict
required
A files dict as expected by requests.post(files=...), e.g. {"files": ("filename.txt", open(..., "rb"))}.
Returns requests.Response.

API Sub-Modules

After construction, Panel exposes the following sub-module attributes. Each sub-module is a thin API wrapper that GenericServer delegates to — you generally call the server-level convenience methods rather than these directly.
AttributeClassDescription
panel.schedulesScheduleAPICreate, update, delete, and run scheduled tasks. See ScheduleAPI.
panel.filesFileManagerAPIList, upload, download, copy, move, compress, and delete server files. See FileManagerAPI.
panel.backupsBackupsAPIList, create, download, and delete server backups. See BackupsAPI.
panel.databasesDatabasesAPIList, create, rotate passwords for, and delete server databases. See DatabasesAPI.
panel.startupStartupAPIRead and update server startup variables. See StartupAPI.
panel.commandsCommandAPISend raw console commands to a server. See CommandAPI.

Build docs developers (and LLMs) love