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