Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ 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
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(
Expand Down
6 changes: 5 additions & 1 deletion examples/create_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
), "Please export your API token in the HCLOUD_TOKEN environment variable"
token = environ["HCLOUD_TOKEN"]

client = Client(token=token)
client = Client(
token=token,
application_name="examples",
application_version="unknown",
)

response = client.servers.create(
name="my-server",
Expand Down
6 changes: 5 additions & 1 deletion examples/get_server_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
), "Please export your API token in the HCLOUD_TOKEN environment variable"
token = environ["HCLOUD_TOKEN"]

client = Client(token=token)
client = Client(
token=token,
application_name="examples",
application_version="unknown",
)

server = client.servers.get_by_name("my-server")
if server is None:
Expand Down
6 changes: 5 additions & 1 deletion examples/list_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
), "Please export your API token in the HCLOUD_TOKEN environment variable"
token = environ["HCLOUD_TOKEN"]

client = Client(token=token)
client = Client(
token=token,
application_name="examples",
application_version="unknown",
)
servers = client.servers.get_all()
print(servers)
6 changes: 5 additions & 1 deletion examples/usage_oop.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
token = environ["HCLOUD_TOKEN"]

# Create a client
client = Client(token=token)
client = Client(
token=token,
application_name="examples",
application_version="unknown",
)

# Create 2 servers
# Create 2 servers
Expand Down
6 changes: 5 additions & 1 deletion examples/usage_procedurale.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
), "Please export your API token in the HCLOUD_TOKEN environment variable"
token = environ["HCLOUD_TOKEN"]

client = Client(token=token)
client = Client(
token=token,
application_name="examples",
application_version="unknown",
)

# Create 2 servers
response1 = client.servers.create(
Expand Down