Added script to list sshkeys
This commit is contained in:
21
sshkeys.py
Executable file
21
sshkeys.py
Executable 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)
|
||||
Reference in New Issue
Block a user