From 1c2369c85ec83c3068cbd7f35f75551de1daa38f Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 9 Jul 2019 10:04:41 +0200 Subject: [PATCH] chg: [aks] search of uid added (WiP) --- bin/aks.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/aks.py b/bin/aks.py index 425aa97..7790ed9 100644 --- a/bin/aks.py +++ b/bin/aks.py @@ -19,15 +19,22 @@ def index(): @app.route('/pks/lookup') def pks(): op = request.args.get('op').lower() - if not (op == 'get' or op == 'search'): - abort(500) + if not (op == 'get' or op == 'index'): + abort(501) search = request.args.get('search') if not search: abort(500) if op == 'get' and search.lower().startswith('0x'): - print('Searching for {}'.format(search)) + print('Get for {}'.format(search)) if backend.exists('k:{}'.format(search.lower()[2:])): return '{}'.format(backend.get('k:{}'.format(search.lower()[2:]))) + if op == 'index' and search.lower(): + print('Searching for {}'.format(search)) + ret = backend.scan(0, 'ue:*{}'.format(search), count=100) + if len(ret[1]) > 0: + return '{}'.format(ret[1]) + else: + abort(404) return '{}\n'.format(op) @app.route('/version')