Skip to main content

codecraftai-restclient-hetzner

A pure-Python REST client for the Hetzner Cloud API v1.

The Hetzner Cloud API is plain REST over HTTPS with JSON bodies and a Bearer API token, so this package speaks it directly rather than depending on the hcloud SDK.

Shape

The api groups mirror the SDK’s grouping, so call sites written against hcloud keep their shape:

from ccai.restclient.hetzner.hetznerrestclient import HetznerRestClient

client = HetznerRestClient(token=token)

existing = client.servers.get_by_name(name="worker-01")

result = client.servers.create(
    name="worker-01", server_type="cx22", image="ubuntu-24.04",
    location="nbg1", ssh_keys=[key], networks=[network],
    firewalls=[firewall], labels={"owner": "ccai"})
server = result.server

owned = client.servers.get_all(label_selector="owner==ccai")

client.servers.delete(server=server)

Five collections are exposed — servers, volumes, networks, firewalls and ssh_keys — each with get_by_name, get_all, get_by_id, create and delete. Volumes additionally carry attach, detach and resize.

Design notes

Objects are attribute addressable, not active record. Responses are HetznerObject — a dict that also answers attribute access, with absent fields reading as None so getattr(obj, "field", None) guards written against the SDK keep behaving the same way. Nested objects are wrapped too, so server.server_type.name resolves. Mutations are NOT methods on the objects; they live on the api groups (client.volumes.detach(volume=volume)), which is the shape the SDK used and the shape consumers already call.

Reference parameters accept whatever the caller holds. create and the action verbs take resource objects, plain dicts or bare ids, and reduce them to the ids the wire format wants — because consumer code assembles handles from earlier creates and passes them straight through.

Pagination is complete. get_all walks every page via meta.pagination. A silently truncated first page would under-report owned resources, which on a teardown path means leaked infrastructure.

Errors are thin. HetznerApiRequestError carries status, reason and body; the reason is lifted out of Hetzner’s {"error": {"code", "message"}} envelope. Translating status codes into a typed hierarchy is the consumer’s policy, not the transport’s.

Metadata

Release files for codecraftai-restclient-hetzner 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codecraftai-restclient-hetzner 1.2.0
File Size Uploaded Provenance
codecraftai_restclient_hetzner-1.2.0.tar.gz 19.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for codecraftai-restclient-hetzner 1.2.0
File Interpreter ABI Platform
codecraftai_restclient_hetzner-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.1 kB

Release files / codecraftai_restclient_hetzner-1.2.0.tar.gz

Download URL codecraftai_restclient_hetzner-1.2.0.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
77f68f095741b641f21613063f352818a3dd08fc05b232f0a68fc3663644a914
BLAKE2b-256 checksum
How to use checksums
0c39056184dd8da7f315455015dcdac06b3406d08db30069d76ed361ae0fb9b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / codecraftai_restclient_hetzner-1.2.0-py3-none-any.whl

Download URL codecraftai_restclient_hetzner-1.2.0-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a4b5bbfeddcb59a726c5f6b16825bc4f5d18f35d2f25f821b6908f7a8e48d12
BLAKE2b-256 checksum
How to use checksums
5c237f4f41a5f44363fddc17f8bdc6d7038b8dffc9a6c77f5196d48efedcdcd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for codecraftai-restclient-hetzner 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codecraftai_restclient_hetzner-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page