# -*- coding: utf-8 -*-

__author__ = """Gustavo Rodríugez"""
__email__ = 'gustavrod@gmail.com'
__version__ = 'v0.2.0'

from flask import Flask
import json
from service import execute_search, combine_duplicate_businesses, write_businesses
from flask_cors import CORS

app = Flask(__name__)
CORS(app)


@app.route('/api/<distance>/<location>/<query>')
def reviews(distance, location, query):
    locations = []
    coords = location.split(",")
    try:
        location = (float(coords[0]), float(coords[1]))
        locations.append(location)
        businesses = execute_search(locations, distance, query)
        return json.dumps(write_businesses(combine_duplicate_businesses(businesses)))
    except Exception:
        return "[]"

@@ -51,10 +51,10 @@
 odr%C3%AD
-u
 g
+u
 ez%22%22

Fix my surname