# Hetzner Cloud Python
[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml)
[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml)
[![](https://codecov.io/github/hetznercloud/hcloud-python/graph/badge.svg?token=3YGRqB5t1L)](https://codecov.io/github/hetznercloud/hcloud-python/tree/main)
[![](https://readthedocs.org/projects/hcloud-python/badge/?version=latest)](https://hcloud-python.readthedocs.io)
[![](https://img.shields.io/pypi/pyversions/hcloud.svg)](https://pypi.org/project/hcloud/)
Official Hetzner Cloud python library.
The library's documentation is available at [hcloud-python.readthedocs.io](https://hcloud-python.readthedocs.io), the public API documentation is available at [docs.hetzner.cloud](https://docs.hetzner.cloud).
## Usage
Install the `hcloud` library:
```sh
pip install hcloud
```
For more installation details, please see the [installation docs](https://hcloud-python.readthedocs.io/en/stable/installation.html).
Here is an example that creates a server and list them:
```python
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](https://hcloud-python.readthedocs.io/en/stable/api.html).
You can find some more examples under the [`examples/`](https://github.com/hetznercloud/hcloud-python/tree/main/examples) directory.
## Supported Python versions
We support python versions until [`end-of-life`](https://devguide.python.org/versions/#status-of-python-versions).
## Development
First, create a virtual environment and activate it:
```sh
make venv
source venv/bin/activate
```
You may setup [`pre-commit`](https://pre-commit.com/) to run before you commit changes, this removes the need to run it manually afterwards:
```sh
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:
```sh
make docs
```
Lint the code:
```sh
make lint
```
Run tests using the current `python3` version:
```sh
make test
```
You may also run the tests for multiple `python3` versions using `tox`:
```sh
tox .
```
## License
The MIT License (MIT). Please see [`License File`](https://github.com/hetznercloud/hcloud-python/blob/main/LICENSE) for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/hetznercloud/hcloud-python",
"name": "hcloud",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "hcloud hetzner cloud",
"author": "Hetzner Cloud GmbH",
"author_email": "support-cloud@hetzner.com",
"download_url": "https://files.pythonhosted.org/packages/fb/48/203f61b2675a6ac012053799bc7c736fa65bd87a4fff1ee4f4f6e651eade/hcloud-1.35.0.tar.gz",
"platform": null,
"description": "# Hetzner Cloud Python\n\n[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/test.yml)\n[![](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml/badge.svg)](https://github.com/hetznercloud/hcloud-python/actions/workflows/lint.yml)\n[![](https://codecov.io/github/hetznercloud/hcloud-python/graph/badge.svg?token=3YGRqB5t1L)](https://codecov.io/github/hetznercloud/hcloud-python/tree/main)\n[![](https://readthedocs.org/projects/hcloud-python/badge/?version=latest)](https://hcloud-python.readthedocs.io)\n[![](https://img.shields.io/pypi/pyversions/hcloud.svg)](https://pypi.org/project/hcloud/)\n\nOfficial Hetzner Cloud python library.\n\nThe library's documentation is available at [hcloud-python.readthedocs.io](https://hcloud-python.readthedocs.io), the public API documentation is available at [docs.hetzner.cloud](https://docs.hetzner.cloud).\n\n## Usage\n\nInstall the `hcloud` library:\n\n```sh\npip install hcloud\n```\n\nFor more installation details, please see the [installation docs](https://hcloud-python.readthedocs.io/en/stable/installation.html).\n\nHere is an example that creates a server and list them:\n\n```python\nfrom hcloud import Client\nfrom hcloud.images import Image\nfrom hcloud.server_types import ServerType\n\nclient = Client(token=\"{YOUR_API_TOKEN}\") # Please paste your API token here\n\n# Create a server named my-server\nresponse = client.servers.create(\n name=\"my-server\",\n server_type=ServerType(name=\"cx11\"),\n image=Image(name=\"ubuntu-22.04\"),\n)\nserver = response.server\nprint(f\"{server.id=} {server.name=} {server.status=}\")\nprint(f\"root password: {response.root_password}\")\n\n# List your servers\nservers = client.servers.get_all()\nfor server in servers:\n print(f\"{server.id=} {server.name=} {server.status=}\")\n```\n\nFor more details, please see the [API reference](https://hcloud-python.readthedocs.io/en/stable/api.html).\n\nYou can find some more examples under the [`examples/`](https://github.com/hetznercloud/hcloud-python/tree/main/examples) directory.\n\n## Supported Python versions\n\nWe support python versions until [`end-of-life`](https://devguide.python.org/versions/#status-of-python-versions).\n\n## Development\n\nFirst, create a virtual environment and activate it:\n\n```sh\nmake venv\nsource venv/bin/activate\n```\n\nYou may setup [`pre-commit`](https://pre-commit.com/) to run before you commit changes, this removes the need to run it manually afterwards:\n\n```sh\npre-commit install\n```\n\nYou can then run different tasks defined in the `Makefile`, below are the most important ones:\n\nBuild the documentation and open it in your browser:\n\n```sh\nmake docs\n```\n\nLint the code:\n\n```sh\nmake lint\n```\n\nRun tests using the current `python3` version:\n\n```sh\nmake test\n```\n\nYou may also run the tests for multiple `python3` versions using `tox`:\n\n```sh\ntox .\n```\n\n## License\n\nThe MIT License (MIT). Please see [`License File`](https://github.com/hetznercloud/hcloud-python/blob/main/LICENSE) for more information.\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "Official Hetzner Cloud python library",
"version": "1.35.0",
"project_urls": {
"Bug Tracker": "https://github.com/hetznercloud/hcloud-python/issues",
"Changelog": "https://github.com/hetznercloud/hcloud-python/blob/main/CHANGELOG.md",
"Documentation": "https://hcloud-python.readthedocs.io/en/stable/",
"Homepage": "https://github.com/hetznercloud/hcloud-python",
"Source Code": "https://github.com/hetznercloud/hcloud-python"
},
"split_keywords": [
"hcloud",
"hetzner",
"cloud"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a90980fabf4c0b4af27b115b99c1361f309cdaed386c6e46721b90238faa9bad",
"md5": "fbc20306565ee2304b4eeb49effd2625",
"sha256": "b03efd72daf456ea5806c1a876694ae4de53cbc658566bc784f24f7534bd617e"
},
"downloads": -1,
"filename": "hcloud-1.35.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fbc20306565ee2304b4eeb49effd2625",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 85379,
"upload_time": "2024-04-02T17:11:57",
"upload_time_iso_8601": "2024-04-02T17:11:57.138353Z",
"url": "https://files.pythonhosted.org/packages/a9/09/80fabf4c0b4af27b115b99c1361f309cdaed386c6e46721b90238faa9bad/hcloud-1.35.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fb48203f61b2675a6ac012053799bc7c736fa65bd87a4fff1ee4f4f6e651eade",
"md5": "44e6c4bd420a1dd397e7a2136ffc2178",
"sha256": "b1949ab637be517b7af6becdbf840c47722f9471c6b870e6f35de1ef6fcea3e3"
},
"downloads": -1,
"filename": "hcloud-1.35.0.tar.gz",
"has_sig": false,
"md5_digest": "44e6c4bd420a1dd397e7a2136ffc2178",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 116320,
"upload_time": "2024-04-02T17:11:59",
"upload_time_iso_8601": "2024-04-02T17:11:59.004734Z",
"url": "https://files.pythonhosted.org/packages/fb/48/203f61b2675a6ac012053799bc7c736fa65bd87a4fff1ee4f4f6e651eade/hcloud-1.35.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-02 17:11:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hetznercloud",
"github_project": "hcloud-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "hcloud"
}