Skip to content

Commit ff6fe87

Browse files
authored
Rename Client & Let APIException return a string (#24)
Closes #23
1 parent 5c82152 commit ff6fe87

14 files changed

Lines changed: 33 additions & 29 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ coverage: ## check code coverage quickly with the default Python
6868
docs: ## generate Sphinx HTML documentation, including API docs
6969
$(MAKE) -C docs clean
7070
$(MAKE) -C docs html
71-
$(BROWSER) docs/_build/html/index.html
71+
$(BROWSER) docs/_build/html/index.html
7272

7373
servedocs: docs ## compile the docs watching for changes
7474
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ hcloud-python API
44
Main Interface
55
---------------
66

7-
.. autoclass:: hcloud.HcloudClient
7+
.. autoclass:: hcloud.Client
88
:members:
99

1010

docs/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Create Server
3434
.. code-block:: python
3535
:linenos:
3636
37-
from hcloud import HcloudClient
37+
from hcloud import Client
3838
from hcloud.server_types.domain import ServerType
3939
from hcloud.images.domain import Image
4040
41-
client = HcloudClient(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
41+
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
4242
response = client.servers.create(name="my-server", server_type=ServerType(name="cx11"), image=Image(name="ubuntu-18.04"))
4343
server = response.server
4444
print(server)
@@ -49,9 +49,9 @@ List Servers
4949
.. code-block:: python
5050
:linenos:
5151
52-
from hcloud import HcloudClient
52+
from hcloud import Client
5353
54-
client = HcloudClient(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
54+
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
5555
servers = client.servers.get_all()
5656
print(servers)
5757

docs/samples.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ To use Hetzner Cloud Python in a project:
66

77
.. code-block:: python
88
9-
from hcloud import HcloudClient
9+
from hcloud import Client
1010
from hcloud.images.domain import Image
1111
from hcloud.server_types.domain import ServerType
1212
1313
# Create a client
14-
client = HcloudClient(token="project-token")
14+
client = Client(token="project-token")
1515
1616
# Create 2 servers
1717
# Create 2 servers

examples/create_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from hcloud import HcloudClient
1+
from hcloud import Client
22
from hcloud.images.domain import Image
33

4-
client = HcloudClient(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
4+
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
55
response = client.servers.create(name="my-server", server_type="cx11", image=Image(name="ubuntu-18.04"))
66
server = response.server
77
print(server)

examples/list_servers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from hcloud import HcloudClient
1+
from hcloud import Client
22

3-
client = HcloudClient(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
3+
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
44
servers = client.servers.get_all()
55
print(servers)

examples/usage_oop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from hcloud import HcloudClient
1+
from hcloud import Client
22
from hcloud.images.domain import Image
33
from hcloud.server_types.domain import ServerType
44

55
# Create a client
6-
client = HcloudClient(token="project-token")
6+
client = Client(token="project-token")
77

88
# Create 2 servers
99
# Create 2 servers

examples/usage_procedurale.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from hcloud import HcloudClient
1+
from hcloud import Client
22

33
from hcloud.images.domain import Image
44
from hcloud.servers.domain import Server
55
from hcloud.server_types.domain import ServerType
66
from hcloud.volumes.domain import Volume
77

8-
client = HcloudClient(token="project-token")
8+
client = Client(token="project-token")
99

1010
# Create 2 servers
1111
response1 = client.servers.create(

hcloud/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
from .hcloud import HcloudClient, APIException # noqa
3+
from .hcloud import Client, APIException # noqa

hcloud/core/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ClientEntityBase(object):
88

99
def __init__(self, client):
1010
"""
11-
:param client: HcloudClient
11+
:param client: Client
1212
:return self
1313
"""
1414
self._client = client

0 commit comments

Comments
 (0)