From 5dba0fa97cc38123098ab87dea9c0101da629be3 Mon Sep 17 00:00:00 2001 From: Koa Wells Date: Fri, 6 Oct 2023 19:29:12 -0400 Subject: [PATCH] Add flask_cors and CORS object for managing cross origin access --- bootstrap.py | 4 +++- requirements.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bootstrap.py b/bootstrap.py index 8316955..78733bb 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -13,6 +13,7 @@ from pathlib import Path from flasgger import LazyJSONEncoder, Swagger from flask import Response from flask_restful import Api +from flask_cors import CORS import threading import hub_api.helpers.session_helper as sh @@ -28,8 +29,9 @@ from hub_api.energy_plus.idf_generator import IdfGenerator sh.begin_time = datetime.datetime.now() app = flask.Flask('cerc_api') app.json_provider_class = LazyJSONEncoder -api = Api(app) +api = Api(app) +CORS(app) api.add_resource(Uptime, '/v1.4/uptime') # Session diff --git a/requirements.txt b/requirements.txt index e99d08f..c891582 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ flask flask_restful>0.3.8 flask-apispec +flask_cors marshmallow apispec geomeppy