Also print total vm count + make result clearer

This commit is contained in:
PCoder 2019-08-20 15:12:36 +05:30
parent fc9dbe9e57
commit 7698db24ce

View file

@ -59,8 +59,14 @@ class ungleichPay(object):
if (response_json['response'] == 'success'): if (response_json['response'] == 'success'):
data = response_json["data"] data = response_json["data"]
rows = [(x['email'], x['vm_count']) for x in data] rows = [(x['email'], x['vm_count']) for x in data]
headers = ["email", "vm_count"] headers = ["customer", "vm_count"]
print("---")
print(tabulate(rows, headers)) print(tabulate(rows, headers))
print("---")
vm_count = 0
for x in data:
vm_count += x['vm_count']
print("Total vm_count = {}".format(vm_count))
else: else:
print("An error occurred.") print("An error occurred.")
print(response_json["message"]) print(response_json["message"])