From 2b407d1f4a608d0ac23592ff16def77797e4fa41 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 31 Mar 2020 20:12:34 +0200 Subject: init thesaurus api client --- cli/commands/api/category.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cli/commands/api/category.py (limited to 'cli/commands/api/category.py') diff --git a/cli/commands/api/category.py b/cli/commands/api/category.py new file mode 100644 index 0000000..5b688f0 --- /dev/null +++ b/cli/commands/api/category.py @@ -0,0 +1,19 @@ +""" +Browse a category +""" + +import click +import simplejson as json + +from app.thesaurus.api import Thesaurus + +@click.command() +@click.option('-c', '--id', 'opt_cat_id', required=True, + help='Category ID') +@click.pass_context +def cli(ctx, opt_cat_id): + """Browse a category + """ + thesaurus = Thesaurus() + results = thesaurus.category(opt_cat_id) + print(json.dumps(results, indent=2)) -- cgit v1.2.3-70-g09d2