from flask import Flask, request from flask_cors import CORS from . import services app = Flask(__name__) app.config.from_object('home.settings') CORS(app) @app.route('/currency') def currency(): base = request.args.get('base', 'CLP') return services.currency.rates(base, app.config['FIXER_KEY']) @app.route('/weather') def weather(): city = request.args.get('city', 'temuco') return services.weather.get(city, app.config['OPENWEATHERMAP_KEY']) @app.route('/photos') def photos(): page = request.args.get('page', 1) return services.photos.get(app.config['UNSPLASH_KEY'], page) @app.route('/quotes') def quotes(): return services.quotes.get() @app.route('/') def hey(): return 'Hey, esta es la api men :c!'