Commit bfb4121d authored by kranthi.kumar's avatar kranthi.kumar

Basic Commit

parent ea97df6c
from flask import Flask
from scripts.service.colour_finder_service import color_finder
app = Flask(__name__)
app.register_blueprint(color_finder)
try:
if __name__ == '__main__':
app.run(port=8007)
except Exception as e:
print(e)
class Find_Colour:
@staticmethod
def find_colour(data):
try:
data_required = set()
for i_data_id, i_data_value in (data['settings']['spc_settings'].items()):
for i_data2_value in i_data_value["data"]:
data_required.add(i_data2_value["color"])
data_required = list(data_required)
return {"data": data_required}
except Exception:
raise Exception("list object does not have add attribute")
from flask import Blueprint
from flask import request
import logging
from scripts.handler.colour_finder_handler import Find_Colour
color_finder = Blueprint('example_blueprint', __name__)
find_colour_object = Find_Colour()
try:
@color_finder.route('/host', methods=['POST'])
def post_request():
content = request.get_json()
required_data = find_colour_object.find_colour(content)
return required_data
except Exception:
logging.info("find colour method is not working")
raise Exception
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment