<commit_before>import os

from bottle import Bottle
from whitenoise import WhiteNoise

from ..settings import DATA_PATH


api = Bottle()

application = WhiteNoise(api)
application.add_files(os.path.join(DATA_PATH, 'thumbnails'), prefix='thumbnails/')
application.add_files(os.path.join(DATA_PATH, 'medias'), prefix='medias/')<commit_msg>Adicionado CORS para a API<commit_after>import os

from bottle import Bottle, response
from whitenoise import WhiteNoise

from ..settings import DATA_PATH


api = Bottle()


@api.hook('after_request')
def enable_cors():
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Methods'] = 'GET, POST, DELETE'


application = WhiteNoise(api)
application.add_files(os.path.join(DATA_PATH, 'thumbnails'), prefix='thumbnails/')
application.add_files(os.path.join(DATA_PATH, 'medias'), prefix='medias/')
{'fraction_non_alphanumeric': 0.13310580204778158, 'fraction_numerical': 0.0, 'mean_word_length': 6.521367521367521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6055011', 'n_tokens_mistral': 294, 'n_tokens_neox': 283, 'n_words': 60}