From 3898468084d70fbd01ef1a5adf6ff47ed9e09013 Mon Sep 17 00:00:00 2001 From: Lulzette Date: Thu, 7 Apr 2022 15:41:50 +0300 Subject: [PATCH] Balance --- twvdscli.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/twvdscli.py b/twvdscli.py index 96d8347..50aa401 100755 --- a/twvdscli.py +++ b/twvdscli.py @@ -51,13 +51,16 @@ class Server: return result.json() +@app.command("balance") def get_balance(): response = requests.get("https://public-api.timeweb.com/api/v1/accounts/finances", headers=reqHeader) if not response.ok: print(typer.style("Error", fg=typer.colors.RED)) sys.exit(1) - - return response.json() + else: + response = response.json() + print('{0:6} {1:}'.format('balance', 'monthly_cost')) + print('{0:6} {1:}'.format(response['finances']['balance'], response['finances']['monthly_cost'])) @servers_app.command("start")