、、、
import os
from flask import Flask,jsonify
import json
app = Flask(__name__)
# Index / search
@app.route('/', methods=['GET', 'POST'])
def index():
error = None
if request.method == 'GET':
data = None
if request.method == 'POST':
search_input = request.form['search']
data = itunes_api.search_album(search_input, 'album', 100)
if not data:
error = 'No search results for ' + search_input
return {'s':12}
@app.route('/info')
def show_info():
data = {'a':1}
return jsonify(data)
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port)
、、、
网友评论