Skip to content

Commit 91c73bd

Browse files
committed
feat: add support for Hetzner API endpoint (#525)
Adds support for the new Hetzner API endpoint.
1 parent 141a469 commit 91c73bd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

hcloud/_client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,14 @@ def __init__(
141141
poll_interval: int | float | BackoffFunction = 1.0,
142142
poll_max_retries: int = 120,
143143
timeout: float | tuple[float, float] | None = None,
144+
*,
145+
api_endpoint_hetzner: str = "https://api.hetzner.com/v1",
144146
):
145147
"""Create a new Client instance
146148
147149
:param token: Hetzner Cloud API token
148150
:param api_endpoint: Hetzner Cloud API endpoint
151+
:param api_endpoint_hetzner: Hetzner API endpoint.
149152
:param application_name: Your application name
150153
:param application_version: Your application _version
151154
:param poll_interval:
@@ -164,6 +167,15 @@ def __init__(
164167
poll_max_retries=poll_max_retries,
165168
timeout=timeout,
166169
)
170+
self._client_hetzner = ClientBase(
171+
token=token,
172+
endpoint=api_endpoint_hetzner,
173+
application_name=application_name,
174+
application_version=application_version,
175+
poll_interval=poll_interval,
176+
poll_max_retries=poll_max_retries,
177+
timeout=timeout,
178+
)
167179

168180
self.datacenters = DatacentersClient(self)
169181
"""DatacentersClient Instance

tests/unit/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def client(request_mock) -> Client:
3333
poll_max_retries=3,
3434
)
3535
c._client.request = request_mock
36+
c._client_hetzner.request = request_mock
3637
return c
3738

3839

0 commit comments

Comments
 (0)