git_brcal/src/server/BreCal/api/notifications.py

23 lines
762 B
Python

from flask import Blueprint, request
from .. import impl
from ..services.auth_guard import auth_guard
import logging
import json
from BreCal.validators.validation_error import create_dynamic_exception_response
bp = Blueprint('notifications', __name__)
@bp.route('/notifications', methods=['get'])
@auth_guard() # no restriction by role
def GetNotifications():
try:
if 'Authorization' in request.headers:
token = request.headers.get('Authorization')
return impl.notifications.GetNotifications(token)
else:
return create_dynamic_exception_response(ex=None, status_code=403, message="not authenticated")
except Exception as ex:
return create_dynamic_exception_response(ex=ex, status_code=400)