mirror of
https://github.com/NohamR/AM-Exporter.git
synced 2026-05-25 19:58:36 +00:00
change api endpoint
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
from flask import Flask, request, jsonify
|
from flask import Flask, request, jsonify
|
||||||
|
from flask_cors import CORS
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
CORS(app, resources={r"/music/*": {"origins": "http://127.0.0.1:5500"}})
|
||||||
|
|
||||||
@app.route('/music/set', methods=['POST'])
|
@app.route('/music/set', methods=['POST'])
|
||||||
def set_content():
|
def set_content():
|
||||||
@@ -8,7 +10,7 @@ def set_content():
|
|||||||
cache = request.get_json()
|
cache = request.get_json()
|
||||||
return jsonify({'message': 'Content set successfully'})
|
return jsonify({'message': 'Content set successfully'})
|
||||||
|
|
||||||
@app.route('/music/display', methods=['GET'])
|
@app.route('/music/get', methods=['GET'])
|
||||||
def display_content():
|
def display_content():
|
||||||
return jsonify(cache)
|
return jsonify(cache)
|
||||||
|
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ json_payload = json.dumps(payload)
|
|||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
r = requests.post(url+'/set', data=json_payload, headers=headers)
|
r = requests.post(url+'/set', data=json_payload, headers=headers)
|
||||||
r = requests.get(url+'/display')
|
r = requests.get(url+'/get')
|
||||||
print(r.text)
|
print(r.text)
|
||||||
Reference in New Issue
Block a user