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

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.1
File Size Uploaded Provenance
codecraftai_restclient_hetzner-1.2.1.tar.gz 18.9 kB With provenance Details

Built distribution (wheel)

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

Total release size: 44.9 kB

Release files / codecraftai_restclient_hetzner-1.2.1.tar.gz

Download URL codecraftai_restclient_hetzner-1.2.1.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8f60dc6199c629af3e92a5de2ed7b69c98eea94532de1e49948887b028168c27
BLAKE2b-256 checksum
How to use checksums
f4b03018a3cd36396d86f50c84c1d3be7aa028b572341bb6070b335d80f47433
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 20, 2026.

Transparency log

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

Download URL codecraftai_restclient_hetzner-1.2.1-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e159ca9f76d71613dcad7b3609aba1a4063b903cc0dd85ecd1f45f2a5cda4e1
BLAKE2b-256 checksum
How to use checksums
f65579e40578f645b21cb43e9eb4084d2e0c1c701de8b8f93bc46db4e000433d
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 20, 2026.

Transparency log

Security for codecraftai-restclient-hetzner 1.2.1

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.1.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 20, 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.1 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