1
0

Added script to list sshkeys

This commit is contained in:
Philipp Klüter
2020-05-22 17:04:25 +02:00
parent d07d4be932
commit 1e51967f95

21
sshkeys.py Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python3
from hcloud import Client, APIException
import argparse
# Get Servername
parser = argparse.ArgumentParser()
parser.add_argument("apiKey")
args = parser.parse_args()
apiKey = args.apiKey
try:
client = Client(token=apiKey)
ssh_keys = client.ssh_keys.get_all()
for ssh_key in ssh_keys:
print("Key Name:", ssh_key.name)
except APIException as e:
print("API Error ", e)