Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test__get_user_agent_with_application_name(self, client):
client = Client(token="project_token", application_name="my-app")
user_agent = client._get_user_agent()
assert user_agent == "my-app hcloud-python/0.0.0"
def client(self):
Client._version = '0.0.0'
return Client(token="project_token")
def test__get_user_agent_with_application_name_and_version(self, client):
client = Client(token="project_token", application_name="my-app", application_version="1.0.0")
user_agent = client._get_user_agent()
assert user_agent == "my-app/1.0.0 hcloud-python/0.0.0"
def client(self):
Client._version = '0.0.0'
return Client(token="project_token")
from hcloud import Client
from hcloud.images.domain import Image
from hcloud.servers.domain import Server
from hcloud.server_types.domain import ServerType
from hcloud.volumes.domain import Volume
client = Client(token="project-token")
# Create 2 servers
response1 = client.servers.create(
name="Server1",
server_type=ServerType(name="cx11"),
image=Image(id=4711)
)
response2 = client.servers.create(
"Server2",
server_type=ServerType(name="cx11"),
image=Image(id=4711)
)
server1 = response1.server
server2 = response2.server
from hcloud import Client
from hcloud.images.domain import Image
from hcloud.server_types.domain import ServerType
# Create a client
client = Client(token="project-token")
# Create 2 servers
# Create 2 servers
response1 = client.servers.create(
"Server1",
server_type=ServerType(name="cx11"),
image=Image(id=4711)
)
response2 = client.servers.create(
"Server2",
server_type=ServerType(name="cx11"),
image=Image(id=4711)
)
# Get all servers
server1 = response1.server
from hcloud import Client
from hcloud.images.domain import Image
from hcloud.server_types.domain import ServerType
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
response = client.servers.create(name="my-server", server_type=ServerType("cx11"), image=Image(name="ubuntu-20.04"))
server = response.server
print(server)
print("Root Password" + response.root_password)
from hcloud import Client
client = Client(token="{YOUR_API_TOKEN}") # Please paste your API token here between the quotes
servers = client.servers.get_all()
print(servers)