replace ugly tables with PrettyTables

This commit is contained in:
Lulzette 2022-04-07 16:08:28 +03:00
parent ca25bbf388
commit 6df227e7e6

View File

@ -8,7 +8,7 @@ import typer
import os
import configparser
import base64
import prettytable
from prettytable import PrettyTable
app = typer.Typer()
servers_app = typer.Typer()
@ -59,9 +59,11 @@ def get_balance():
print(typer.style("Error", fg=typer.colors.RED))
sys.exit(1)
else:
x = PrettyTable()
x.field_names = ["Balance", "Monthly cost"]
response = response.json()
print('{0:6} {1:}'.format('balance', 'monthly_cost'))
print('{0:6} {1:}'.format(response['finances']['balance'], response['finances']['monthly_cost']))
x.add_row([response['finances']['balance'], response['finances']['monthly_cost']])
print(x)
@servers_app.command("start")