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

12
list.py Normal file → Executable file
View File

@@ -1,6 +1,16 @@
#!/usr/bin/env python3
from hcloud import Client
import argparse
# Get Servername
parser = argparse.ArgumentParser()
parser.add_argument("apiKey")
args = parser.parse_args()
apiKey = args.apiKey
# Please paste your API token here between the quotes
client = Client(token=apiKey)
client = Client(token="JalvbaPbizgErC2PoBSmDiFX0TKW0WLzbarxwFyNtJpx1xCvnEx3LI1B2Thl836f") # Please paste your API token here between the quotes
servers = client.servers.get_all()
for server in servers:
print("Servername:", server.name)