mirror of
https://github.com/OVERLORD7F/SVMU.git
synced 2025-10-01 21:52:47 +03:00
LEETS GOOOOOOOO
main is less then 100 lines !!!! Code cleanup, all functions moved from main. Small changes in main menu vm_info_short moved to domain_api
This commit is contained in:
@@ -1,22 +1,2 @@
|
||||
|
||||
#from main import base_url , api_key , requests
|
||||
import requests
|
||||
|
||||
def vm_info_short(base_url , api_key): #output data pool info
|
||||
url= f"http://{base_url}//api/domains/"
|
||||
response = requests.get(url , headers={'Authorization' : api_key})
|
||||
|
||||
if response.status_code == 200:
|
||||
vm_info_short = response.json()
|
||||
results_vm_info_short = vm_info_short['results']
|
||||
|
||||
print("\nShort VM overview")
|
||||
print(f"\nVM total: {vm_info_short['count']}")
|
||||
print("-" * 41)
|
||||
for x in results_vm_info_short:
|
||||
print(" "*16,f"VM {x['verbose_name']}")
|
||||
print(f"UID: {x['id']}")
|
||||
print("-" * 41)
|
||||
|
||||
else:
|
||||
print(f"Failed to retrieve data {response.status_code}")
|
Reference in New Issue
Block a user