From cec099b97e079dc116a0966343e4dd0a254c5e34 Mon Sep 17 00:00:00 2001 From: Lulzette Date: Sun, 27 Mar 2022 23:36:21 +0300 Subject: [PATCH] human readable plans --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index f195900..13e0d85 100755 --- a/main.py +++ b/main.py @@ -39,7 +39,10 @@ def get_balance(): @app.command() def get_tariffs(): response = requests.get("https://api.cloudvps.reg.ru/v1/prices", headers=reqHeader) - print(json.dumps(response.json(),indent=4)) + print('{0:17} {1:5} {2:5} {3:6}'.format('name', 'hour', 'month', 'unit')) + for i in response.json()['prices']: + if i['type'] == 'reglet': + print('{0:17} {1:5} {2:5} {3:6}'.format(i['plan'], i['price'], i['price_month'], i['unit'])) @app.command()