1
0

Added Argparse

This commit is contained in:
Philipp Klüter
2020-05-17 23:25:02 +02:00
parent e02e6272d2
commit c8248ef7bf
7 changed files with 127 additions and 110 deletions

13
details.py Normal file → Executable file
View File

@@ -1,13 +1,20 @@
#!/usr/bin/env python3
from hcloud import Client
import argparse
# Get Servername
parser = argparse.ArgumentParser()
parser.add_argument("serverName")
parser.add_argument("apiKey")
args = parser.parse_args()
serverName = args.serverName
print(serverName)
client = Client(token="JalvbaPbizgErC2PoBSmDiFX0TKW0WLzbarxwFyNtJpx1xCvnEx3LI1B2Thl836f") # Please paste your API token here between the quotes
apiKey = args.apiKey
# Please paste your API token here between the quotes
client = Client(token=apiKey)
server = client.servers.get_by_name(serverName)
print("Name: ", server.name)
print("Status: ", server.status)
print("Type: ", server.server_type.name)