From a846243f0cce886fb12a0b88f88cccf301fbeea1 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Tue, 28 Jan 2020 23:35:24 -0600 Subject: [PATCH] get ready for the graph --- app.py | 8 ++++++-- run_locally.sh | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 46781a5..49ce9a0 100644 --- a/app.py +++ b/app.py @@ -6,7 +6,8 @@ import requests import cachetools -from flask import Flask, request, jsonify, render_template, make_response +from flask import ( + Flask, request, make_response, jsonify, render_template) REPOS = cachetools.LRUCache(maxsize=128) RATES = cachetools.LRUCache(maxsize=96) @@ -109,7 +110,10 @@ def index(): @app.route('/report') def report(): - return jsonify(_make_report_data(iso=True)) + data = _make_report_data(iso=True) + resp = make_response(jsonify(data)) + resp.headers['Access-Control-Allow-Origin'] = "*" + return resp @app.route('/payload', methods=['POST']) diff --git a/run_locally.sh b/run_locally.sh index 18b125a..8fc4d8c 100755 --- a/run_locally.sh +++ b/run_locally.sh @@ -1,4 +1,4 @@ #!/bin/bash export FLASK_APP=app.py -python -m flask run --port=4632 +python -m flask run