Official Hetzner Cloud python library
Project description
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
# Create a server named my-server
response = client.servers.create(
name="my-server",
server_type=ServerType(name="cx11"),
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=}")
For more details, please see the API reference.
You can find some more examples under the examples/ directory.
Supported Python versions
We support python versions until end-of-life.
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 .
License
The MIT License (MIT). Please see License File for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hcloud-1.27.2.tar.gz.
File metadata
- Download URL: hcloud-1.27.2.tar.gz
- Upload date:
- Size: 104.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5ba2f388de5652ea8163767350e16a3df473765a7613bdb251fa87cc7c7c63d
|
|
| MD5 |
5db3e2d4671df4e9a37bb3ec93171875
|
|
| BLAKE2b-256 |
cd66b1692e2c3fd162d227ea71e9e9f9fd6901bef5afe406a602aa7685f8e99a
|
File details
Details for the file hcloud-1.27.2-py3-none-any.whl.
File metadata
- Download URL: hcloud-1.27.2-py3-none-any.whl
- Upload date:
- Size: 79.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5e8e094d199d127f3aba021da4f92589fbd609cfcb324147c26fb917e275396
|
|
| MD5 |
645148e4db07eface37a082355965eb7
|
|
| BLAKE2b-256 |
e52e6f2809050d697281c0f78cbbd074df72833c56d2e1c63a953f5aba06b25a
|