Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (34 sloc) 1.13 KB
import logging
from flask import Flask, render_template, request
from flask.json import jsonify
from google.appengine.ext import deferred
from search_api import SearchAPI
app = Flask(__name__)
search_client = SearchAPI()
def index():
return render_template('index.html')
def search():
"""based on user query it executes search and returns list of item in json"""
query = request.args.get('query', '')
results =
return jsonify(results)
@app.route('/upload', methods=['POST'])
def upload():
"""gets data for one product and saves into search index"""
json_data = request.get_json()
return 'ok'
@app.route('/upload_bulk', methods=['POST'])
def upload_bulk():
"""gets list of products and saves into search index"""
json_data = request.get_json()"received {} items".format(len(json_data)))
return 'ok'
def delete():
"""deletes all items in search"""
return 'ok'