Simplificada y mejorada la api :3
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from flask import Flask
|
||||
from flask import Flask, request
|
||||
from . import services
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -6,16 +6,19 @@ app.config.from_object('home.settings')
|
||||
|
||||
@app.route('/currency')
|
||||
def currency():
|
||||
return services.currency.get(app.config['FOREX_KEY'])
|
||||
base = request.args.get('base', 'CLP')
|
||||
return services.currency.rates(base, app.config['FIXER_KEY'])
|
||||
|
||||
@app.route('/weather')
|
||||
def weather():
|
||||
return services.weather.get('temuco', app.config['OPENWEATHERMAP_KEY'])
|
||||
city = request.args.get('city', 'temuco')
|
||||
return services.weather.get(city, app.config['OPENWEATHERMAP_KEY'])
|
||||
|
||||
@app.route('/photos')
|
||||
def photos():
|
||||
return services.photos.get(app.config['UNSPLASH_KEY'])
|
||||
page = request.args.get('page', 1)
|
||||
return services.photos.get(app.config['UNSPLASH_KEY'], page)
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
return 'Hello, World!'
|
||||
def hey():
|
||||
return 'Hey, esta es la api men :c!'
|
||||
|
||||
Reference in New Issue
Block a user