From 2df5c216a639b28bde908f54c05b55f00a05edc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Materna?= Date: Fri, 22 May 2020 07:31:51 +0200 Subject: [PATCH] CORS allowed for REST APIs. (#124) --- arcor2/VERSION | 2 +- arcor2/nodes/build.py | 2 ++ arcor2/nodes/execution_proxy.py | 2 ++ setup.py | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arcor2/VERSION b/arcor2/VERSION index 2b7c5ae0..17b2ccd9 100644 --- a/arcor2/VERSION +++ b/arcor2/VERSION @@ -1 +1 @@ -0.4.2 +0.4.3 diff --git a/arcor2/nodes/build.py b/arcor2/nodes/build.py index 8b04897b..b8b76350 100755 --- a/arcor2/nodes/build.py +++ b/arcor2/nodes/build.py @@ -13,6 +13,7 @@ from apispec import APISpec # type: ignore from apispec_webframeworks.flask import FlaskPlugin # type: ignore from flask import Flask, send_file +from flask_cors import CORS # type: ignore from flask_swagger_ui import get_swaggerui_blueprint # type: ignore import arcor2 @@ -42,6 +43,7 @@ ) app = Flask(__name__) +CORS(app) def _publish(project_id: str): diff --git a/arcor2/nodes/execution_proxy.py b/arcor2/nodes/execution_proxy.py index be9ee5bd..8f7fb1ee 100755 --- a/arcor2/nodes/execution_proxy.py +++ b/arcor2/nodes/execution_proxy.py @@ -13,6 +13,7 @@ from apispec import APISpec # type: ignore from apispec_webframeworks.flask import FlaskPlugin # type: ignore from flask import Flask, jsonify, request, send_file +from flask_cors import CORS # type: ignore from flask_swagger_ui import get_swaggerui_blueprint # type: ignore from werkzeug.utils import secure_filename @@ -34,6 +35,7 @@ ) app = Flask(__name__) +CORS(app) # TODO find out why long-lasting connection is not possible (it is getting disconnected after few minutes) diff --git a/setup.py b/setup.py index 33d7e87d..e1accce7 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,8 @@ 'flask_swagger_ui', 'websocket-client', 'pyyaml', # dependency of apispec, for some reason not installed automatically... - 'Pillow' + 'Pillow', + 'flask-cors' ], extras_require={ 'test': [