Skip to main content

Unofficial Hetzner Robot Webservice OpenAPI client and CLI

Project description

hrobot-py

hrobot-py is an unofficial Python client and command line interface for the Hetzner Robot Webservice API. It includes an OpenAPI specification, a generated Python client, and the hrobot CLI.

Disclaimer: this project is not affiliated with, endorsed by, or maintained by Hetzner. It targets the Hetzner Robot Webservice API for dedicated servers, not the Hetzner Cloud API.

Requirements

You need a Hetzner Robot Webservice user. Robot Webservice credentials can be created in the Robot web interface under the account preferences/settings area.

Installation

pip install hrobot-py

Credentials

The CLI reads credentials from the environment:

export HROBOT_USER='your-robot-webservice-user'
export HROBOT_PASSWORD='your-robot-webservice-password'

You can also provide the username and enter the password interactively:

hrobot --user your-robot-webservice-user --ask-password servers

Or load a simple shell-style env file with HROBOT_USER and HROBOT_PASSWORD:

hrobot --env-file .env servers

Be careful with repeated bad credentials: the Robot documentation says the source IP can be blocked temporarily after multiple failed login attempts.

CLI examples

hrobot servers
hrobot server 123456

hrobot ips
hrobot ip 203.0.113.10

hrobot reset options
hrobot boot status 123456
hrobot boot rescue options 123456
hrobot wol status 123456

The CLI prints JSON by default. Use --compact for compact output and --show-status to include the HTTP status code.

Some operations can change server state, destroy data, or affect billing. These commands require confirmation unless --yes is supplied:

hrobot boot rescue activate 123456 --os linux --arch 64 --authorized-key 'fingerprint'
hrobot reset execute 123456 --type hw
hrobot wol trigger 123456

The raw command can call endpoints that do not have a dedicated CLI wrapper:

hrobot raw GET /server
hrobot raw GET /boot/123456/rescue
hrobot raw POST /reset/123456 --data type=hw --dry-run

Secret-looking response fields such as password are redacted by default. Use --show-secrets only when you intentionally need to display returned secrets.

Python client example

import os

import httpx

from hetzner_robot_webservice_api_unofficial_client import Client
from hetzner_robot_webservice_api_unofficial_client.api.server import list_servers

client = Client(
    base_url="https://robot-ws.your-server.de",
    httpx_args={
        "auth": httpx.BasicAuth(
            os.environ["HROBOT_USER"],
            os.environ["HROBOT_PASSWORD"],
        ),
    },
)

with client:
    response = list_servers.sync_detailed(client=client)

print(response.status_code)
print(response.parsed)

OpenAPI and generated client

The OpenAPI document is stored at the repository root:

openapi-hetzner-robot-unofficial.json

The Python client is generated with openapi-python-client. The OpenAPI specification is the source of truth; generated code should be regenerated from it instead of patched by hand.

openapi-python-client generate \
  --path openapi-hetzner-robot-unofficial.json \
  --meta none \
  --output-path src/hetzner_robot_webservice_api_unofficial_client \
  --overwrite

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

hrobot_py-0.1.0.tar.gz (130.3 kB view details)

Uploaded Source

Built Distribution

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

hrobot_py-0.1.0-py3-none-any.whl (379.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hrobot_py-0.1.0.tar.gz
  • Upload date:
  • Size: 130.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for hrobot_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ef4da429fbab53eae0294d1bcd7cb64ede198f35a19c0b8dc12f1e9b509aa6fa
MD5 47bbc21e2586b74ae8e42d8a1ba41efa
BLAKE2b-256 b1b7e46311bd0bddd86a4453efa6e409c0e778f7d9cb92032ac697b7bb0792df

See more details on using hashes here.

File details

Details for the file hrobot_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hrobot_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 379.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for hrobot_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f929b90ca9983a8c06b3a309de3408c64819ea9d3b0db78289bf49829fbf6c88
MD5 4986b2953800973845db48469f76597a
BLAKE2b-256 2f8bcd2e91f8d138a93cf253ee063087b4bc887a151acaffae8e17df7270c59a

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