-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathapp.py
23 lines (19 loc) · 768 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask,request,jsonify,json
import jiomusic
app = Flask(__name__)
app.secret_key = 'thankyoutonystark#weloveyou3000'
@app.route('/')
def home():
return "Thanks for testing JioMusic API. To get started head up to my GitHub for documentation."
@app.route('/result/', methods=['GET'])
def result():
query=request.args.get('query')
if jiomusic.song_search(query=query) is not None:
return jsonify(jiomusic.song_search(query=query))
else:
# Not catching any error because I hope this will never crash!
# You should not get this message eveeeeeeeeeeeeer!
return "Something went wrong!"
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0',port=5000,use_reloader=True,threaded = True)