cors
This commit is contained in:
parent
14ee7ef987
commit
4173bc65fd
@ -1,3 +1,4 @@
|
||||
python-dotenv
|
||||
flask
|
||||
requests
|
||||
requests
|
||||
flask-cors
|
@ -1,9 +1,12 @@
|
||||
from flask import Flask, request, jsonify, render_template
|
||||
import requests, os, dotenv, json, base64, time
|
||||
from flask import Flask, request, jsonify
|
||||
import requests, os, dotenv, json, base64
|
||||
from flask_cors import CORS, cross_origin
|
||||
|
||||
# Initialize Flask app
|
||||
|
||||
app = Flask(__name__)
|
||||
cors = CORS(app)
|
||||
app.config['CORS_HEADERS'] = 'Content-Type'
|
||||
|
||||
if os.path.exists('.env'):
|
||||
dotenv.load_dotenv('.env')
|
||||
@ -69,6 +72,7 @@ def auth():
|
||||
return "Authenticated"
|
||||
|
||||
@app.route('/api/nowplaying', methods=['GET'])
|
||||
@cross_origin()
|
||||
def nowplaying():
|
||||
cache = get_cache()
|
||||
data = requests.get('https://api.spotify.com/v1/me/player/currently-playing', headers={
|
||||
|
Loading…
Reference in New Issue
Block a user