25 lines
636 B
Python
25 lines
636 B
Python
from flask import Flask, request
|
|
from . import services
|
|
|
|
app = Flask(__name__)
|
|
app.config.from_object('home.settings')
|
|
|
|
@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('/')
|
|
def hey():
|
|
return 'Hey, esta es la api men :c!'
|