Skip to content

Commit 7ceeafd

Browse files
Merge pull request #27 from aitomatic/fix/update_data_returned_api_list
Fix/update data returned api list
2 parents 2963486 + 80ae265 commit 7ceeafd

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
click == 8.0.4 # library to create CLI
22
requests == 2.27.1
33
configparser >= 5.2.0
4+
prettytable >= 3.3.0

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ install_requires =
2929
click == 8.0.4
3030
requests == 2.27.1
3131
configparser >= 5.2.0
32+
prettytable >= 3.3.0
3233
python_requires = >=3.7
3334
cmdclass =
3435
install = post_install.Install

src/list/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import click
22
from src.api.aitomatic import AiCloudApi
33
from src.login.main import authenticated
4+
from prettytable import PrettyTable
45

56

67
@click.command()
@@ -16,10 +17,11 @@ def list(obj, app_name: str, n: int) -> None:
1617
res = api.list_jobs(app_name=app_name)
1718
data = res.json()
1819

19-
jobs = data['jobs']
20+
jobs = data['data']
2021
if len(jobs) > 0:
21-
click.secho('ID Status Created at', fg='green')
22+
table = PrettyTable(['ID', 'Status', 'Created at'])
2223
for job in jobs:
23-
click.echo(f"{job['id']} {job['status']} {job['createdAt']}")
24+
table.add_row([job['id'], job['status'], job['createdAt']])
25+
click.echo(table)
2426
else:
2527
click.echo('This app has no job')

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.1
1+
0.12.2

0 commit comments

Comments
 (0)