# Path: errors.py
# class UnauthorizedAPIAccessError(YodaError):
#     pass


import json
from traceback import print_exc
from flask import Blueprint, g, jsonify, request
from irods import rule
from errors import UnauthorizedAPIAccessError
#!/usr/bin/env python3

__copyright__ = 'Copyright (c) 2021, Utrecht University'
__license__   = 'GPLv3, see LICENSE'




api_bp = Blueprint('api_bp', __name__)


@api_bp.route('/<fn>', methods=['POST'])
def _call(fn):
    if not authenticated():
        raise UnauthorizedAPIAccessError

    if 'data' in request.form:
        data = json.loads(request.form['data'])
    else:
        data = {}

    result = call(fn, data)
    code = 200

    if result['status'] == 'error_internal':

# Path: errors.py
# class UnauthorizedAPIAccessError(YodaError):
#     pass


# Path: api.py
import json
from traceback import print_exc
from flask import Blueprint, g, jsonify, request
from irods import rule
from errors import UnauthorizedAPIAccessError

#!/usr/bin/env python3

__copyright__ = 'Copyright (c) 2021, Utrecht University'
__license__   = 'GPLv3, see LICENSE'




api_bp = Blueprint('api_bp', __name__)


@api_bp.route('/<fn>', methods=['POST'])
def _call(fn):
    if not authenticated():
        raise UnauthorizedAPIAccessError

    if 'data' in request.form:
        data = json.loads(request.form['data'])
    else:
        data = {}

    result = call(fn, data)
    code = 200

    if result['status'] == 'error_internal':

        code = 500