Пример #1
0
def get_documents_url():

    try:
        args = dict(flask.request.args)
        user_dict = util.get_api_user(args)
        value = document_getter.get_documents(args, user_dict, mongo_collection)
    except Exception as e:
        msg = f"ERROR: from /get_documents: {e}"
        util.log_email(msg, error=True)
        return msg

    return value
Пример #2
0
def archive_failed_url():

    try:
        args = dict(flask.request.args)
        user_dict = util.get_api_user(args)
        if not user_dict.get("admin"):
            raise Exception("/archive_failed is only available to admins.")
        value = status_updater.archive_failed(args, user_dict, mongo_collection)
    except Exception as e:
        msg = f"ERROR: from /archive_failed: {e}"
        util.log_email(msg, error=True)
        return msg

    return value
Пример #3
0
def get_last_document_url():

    try:
        args = dict(flask.request.args)
        user_dict = util.get_api_user(args)
        if not user_dict.get("admin"):
            raise Exception("/get_last_document is only available to admins.")
        value = document_getter.get_last_document(args, user_dict, mongo_collection)
    except Exception as e:
        msg = f"ERROR: from /get_last_document: {e}"
        util.log_email(msg, error=True)
        return msg

    return value