Skip to main content

Hetzner Cloud Python

Official Hetzner Cloud python library.

The library's documentation is available at hcloud-python.readthedocs.io, the public API documentation is available at docs.hetzner.cloud.

Usage

Install the hcloud library:

pip install hcloud

For more installation details, please see the installation docs.

Here is an example that creates a server and list them:

from hcloud import Client
from hcloud.images import Image
from hcloud.server_types import ServerType

client = Client(
    token="{YOUR_API_TOKEN}", # Please paste your API token here
    application_name="my-app",
    application_version="v1.0.0",
)

# Create a server named my-server
response = client.servers.create(
    name="my-server",
    server_type=ServerType(name="cx23"),
    image=Image(name="ubuntu-22.04"),
)
server = response.server
print(f"{server.id=} {server.name=} {server.status=}")
print(f"root password: {response.root_password}")

# List your servers
servers = client.servers.get_all()
for server in servers:
    print(f"{server.id=} {server.name=} {server.status=}")

Supported Python versions

We support python versions until end-of-life.

Experimental features

Experimental features are published as part of our regular releases (e.g. a product public beta). During an experimental phase, breaking changes on those features may occur within minor releases.

The stability of experimental features is not related to the stability of its upstream API.

Experimental features have different levels of maturity (e.g. experimental, alpha, beta) based on the maturity of the upstream API.

While experimental features will be announced in the release notes, you can also find whether a python class or function is experimental in its docstring:

Experimental:
    $PRODUCT is $MATURITY, breaking changes may occur within minor releases.
    See https://docs.hetzner.cloud/changelog#$SLUG for more details.

Development

First, create a virtual environment and activate it:

make venv
source venv/bin/activate

You may setup pre-commit to run before you commit changes, this removes the need to run it manually afterwards:

pre-commit install

You can then run different tasks defined in the Makefile, below are the most important ones:

Build the documentation and open it in your browser:

make docs

Lint the code:

make lint

Run tests using the current python3 version:

make test

You may also run the tests for multiple python3 versions using tox:

tox .

Deprecations implementation

When deprecating a module or a function, you must:

  • Update the docstring with a deprecated notice:
"""Get image by name

.. deprecated:: 1.19
    Use :func:`hcloud.images.client.ImagesClient.get_by_name_and_architecture` instead.
"""
  • Raise a warning when the deprecated module or function is being used:
warnings.warn(
    "The 'hcloud.images.client.ImagesClient.get_by_name' method is deprecated, please use the "
    "'hcloud.images.client.ImagesClient.get_by_name_and_architecture' method instead.",
    DeprecationWarning,
    stacklevel=2,
)

Releasing experimental features

To publish experimental features as part of regular releases:

  • an announcement, including a link to a changelog entry, must be added to the release notes.

  • an Experimental notice, including a link to a changelog entry, must be added to the python classes and functions that are experimental:

    """
    Experimental:
        $PRODUCT is $MATURITY, breaking changes may occur within minor releases.
        See https://docs.hetzner.cloud/changelog#$SLUG for more details.
    """
    

License

The MIT License (MIT). Please see License File for more information.

Release files for hcloud 2.25.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 hcloud 2.25.1
File Size Uploaded
hcloud-2.25.1.tar.gz 157.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hcloud 2.25.1
File Interpreter ABI Platform
hcloud-2.25.1-py3-none-any.whl Python 3 none any Details

Total release size: 269.9 kB

Release files / hcloud-2.25.1.tar.gz

Download URL hcloud-2.25.1.tar.gz
Size 157.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5e7b3da8810b82f448aa90bb1979e3102fd46eff8847cca655cb33b174995f53
BLAKE2b-256 checksum
How to use checksums
e7e40d9c9dc03a309ebedb7df670b878afecac8b997d72063df518601595c7a3
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 Sep 17, 2026.

Transparency log

Release files / hcloud-2.25.1-py3-none-any.whl

Download URL hcloud-2.25.1-py3-none-any.whl
Size 112.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
794f885b9f0995501aa6ea08670fdfbe4e7edeb69127c6940b5f97714ab3dd51
BLAKE2b-256 checksum
How to use checksums
80f0451a0c5b582f57e80ed24c994fccefe2f06d4253a5b1bcb3d8aeb6813c6e
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 Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.25.1 This release

2 release files

2.25.0

2 release files

2.24.0

2 release files

2.23.0

2 release files

2.22.0

2 release files

2.21.0

2 release files

2.19.0

2 release files

2.18.0

2 release files

2.17.1

2 release files

2.16.0

2 release files

2.15.0

2 release files

2.13.0

2 release files

2.12.0

2 release files

2.11.1

2 release files

2.11.0

2 release files

2.9.0

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.4

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.34.0

2 release files

1.33.3

2 release files

1.33.0

2 release files

1.32.0

2 release files

1.31.0

2 release files

1.30.0

2 release files

1.29.1

2 release files

1.29.0

2 release files

1.28.0

2 release files

1.26.0

2 release files

1.25.0

2 release files

1.23.1

2 release files

1.23.0

2 release files

1.22.0

2 release files

1.21.0

2 release files

1.20.0

2 release files

1.19.0

2 release files

1.18.2

2 release files

1.18.1

2 release files

1.18.0

2 release files

1.17.0

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.14.1

2 release files

1.13.0

2 release files

1.11.0

2 release files

1.10.0

1 release file

1.9.1

1 release file

1.9.0

1 release file

1.8.2

1 release file

1.8.1

1 release file

1.7.1

1 release file

1.7.0

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.5.0

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

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