add CORS rule for ANY origin

This commit is contained in:
Greg Gauthier 2024-06-22 22:29:19 +01:00
parent 4dc0bb94b4
commit 4e9cd5593a
2 changed files with 8 additions and 6 deletions

11
app.py
View File

@ -1,4 +1,5 @@
from flask import Flask
from flask_cors import CORS
from flask_restx import Api, Resource
from marshmallow import Schema, fields, validate
from models import dice_model, ability_model, hp_model, character_model
@ -6,6 +7,8 @@ from mutations import Mutations
import random
app = Flask(__name__)
CORS(app)
app.config.SWAGGER_UI_JSONEDITOR = True
app.config['SWAGGER_UI_JSONEDITOR'] = True
api = Api(app, version='1.0', title='Gamma World Dice', description='Rolled Dice As A Service')
@ -229,7 +232,7 @@ def roll_mutations(conscore, intscore):
"""
mutations_table = {}
mental_mutations_cnt = roll_dices(1,4, False).get('result')
mental_mutations_cnt = roll_dices(1, 4, False).get('result')
physical_mutations_cnt = roll_dices(1, 4, False).get('result')
mutations_table['count'] = {'mental': mental_mutations_cnt, 'physical': physical_mutations_cnt}
@ -239,7 +242,7 @@ def roll_mutations(conscore, intscore):
for _ in range(mental_mutations_cnt):
mscore = roll_dices(1, 100, False).get('result') + intscore
if mscore in mental_mutations_scores:
mscore = mscore-3
mscore = mscore - 3
if mscore > 100:
mscore = 100
@ -248,7 +251,7 @@ def roll_mutations(conscore, intscore):
for _ in range(physical_mutations_cnt):
pscore = roll_dices(1, 100, False).get('result') + conscore
if pscore in physical_mutations_scores:
pscore = pscore-3
pscore = pscore - 3
if pscore > 100:
pscore = 100
@ -273,7 +276,5 @@ def roll_mutations(conscore, intscore):
return mutations_table
if __name__ == '__main__':
app.run()

View File

@ -1,4 +1,5 @@
Flask~=3.0.3
flask-restx~=1.3.0
marshmallow~=3.21.3
pandas~=2.2.2
pandas~=2.2.2
flask-cors~=4.0.1