Skip to content

Commit 6e2b31e

Browse files
author
Josh Ferrerra
committed
use header instead of flask-cors
1 parent 4e33374 commit 6e2b31e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

intelligence/anthill/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ubuntu:16.04
33
RUN apt-get update && apt-get install -y python3 python3-pip \
44
&& apt-get clean
55

6-
RUN pip3 install numpy scipy Flask flask-cors neo4j-driver==1.1.0
6+
RUN pip3 install numpy scipy Flask neo4j-driver==1.1.0
77

88
RUN mkdir -p /anthill
99
ADD . /anthill/

intelligence/anthill/src/router.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22

3-
from flask import Flask, request, jsonify
4-
from flask_cors import cross_origin
3+
from flask import Flask, request, jsonify, make_response
54
from managers.Prod_Prod_Manager import Prod_Prod_Manager
65
from util.ES_Client import ES_Client
76
from util.InvalidUsage import InvalidUsage
@@ -41,7 +40,6 @@ def rec_prod_prod(prod_id):
4140
return jsonify(resp)
4241

4342
@APP.route('/public/prod-prod/full/<int:prod_id>', methods=['GET'])
44-
@cross_origin()
4543
def rec_prod_prod_full(prod_id):
4644
"""rec_prod_prod_full
4745
returns a list of full products from elasticsearch
@@ -50,7 +48,9 @@ def rec_prod_prod_full(prod_id):
5048
size_param = int(request.args.get('size', 10))
5149
from_param = int(request.args.get('from', 0))
5250
full_resp = PP_MANAGER.recommend_full(prod_id, channel_id, from_param, size_param)
53-
return jsonify(full_resp)
51+
resp = make_response(jsonify(full_resp))
52+
resp.headers['Allow-Control-Allow-Origin'] = '*'
53+
return resp
5454

5555
@APP.route('/public/cust-prod/<int:cust_id>', methods=['GET'])
5656
def rec_cust_prod(cust_id):

0 commit comments

Comments
 (0)