summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2014-03-20 10:28:24 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2014-03-20 10:28:24 +0100
commit8abf4ab993cd4a81dc97f85fb8a30a6c875221f7 (patch)
tree80ec3b61ecfae137767ad4aee821b9e0162ebba8 /searx/webapp.py
parentb5c695c6f525eb692d3e476817b49d2661ba2d25 (diff)
adding initial code for backend-part of autocompleter
including test-code
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 2f6aa4abe..e818ae710 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -221,6 +221,24 @@ def about():
return render('about.html')
+@app.route('/autocompleter', methods=['GET', 'POST'])
+def autocompleter():
+ """Return autocompleter results"""
+ request_data = {}
+
+ if request.method == 'POST':
+ request_data = request.form
+ else:
+ request_data = request.args
+
+ # TODO fix XSS-vulnerability, remove test code
+ autocompleter.querry = request_data.get('q')
+ autocompleter.results = [autocompleter.querry]
+
+ return Response(json.dumps(autocompleter.results),
+ mimetype='application/json')
+
+
@app.route('/preferences', methods=['GET', 'POST'])
def preferences():
"""Render preferences page.