<commit_before>from flask import Blueprint, jsonify
from j4oauth.app import ldaptools, oauth
from j4oauth.evetools import EveTools
from j4oauth.utils import api_check

api = Blueprint('api', __name__)


@api.route('/v1/auth_user')
@oauth.require_oauth('auth_info')
def auth_user(req):
    """
    Example of a oauth request, req.user will contain the user model.
    We also protected this request with the scope 'info'
    """
    return jsonify(user={
        'main_character': req.user.character_name,
        'corporation': req.user.main_corporation,
        'alliance': req.user.main_alliance,
        'auth_status': req.user.accountStatus[0]
    })


@api.route('/v1/auth_groups')
@oauth.require_oauth('auth_groups')
def auth_groups(req):
    """
    Return Auth groups
    """
    return jsonify(groups=[group for group in req.user.get_authgroups()])


@api.route('/v1/characters')
@oauth.require_oauth('characters')<commit_msg>Add user_id and character_id<commit_after>from flask import Blueprint, jsonify
from j4oauth.app import ldaptools, oauth
from j4oauth.evetools import EveTools
from j4oauth.utils import api_check

api = Blueprint('api', __name__)


@api.route('/v1/auth_user')
@oauth.require_oauth('auth_info')
def auth_user(req):
    """
    Example of a oauth request, req.user will contain the user model.
    We also protected this request with the scope 'info'
    """
    return jsonify(user={
        'user_id': req.user.id,
        'main_character': req.user.character_name,
        'main_character_id': req.user.character_id,
        'corporation': req.user.main_corporation,
        'alliance': req.user.main_alliance,
        'auth_status': req.user.accountStatus[0]
    })


@api.route('/v1/auth_groups')
@oauth.require_oauth('auth_groups')
def auth_groups(req):
    """
    Return Auth groups
    """
    return jsonify(groups=[group for group in req.user.get_authgroups()])


@api.route('/v1/characters')
@oauth.require_oauth('characters')
{'fraction_non_alphanumeric': 0.12595226003047233, 'fraction_numerical': 0.007110208227526663, 'mean_word_length': 4.051282051282051, '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': '4773379', 'n_tokens_mistral': 666, 'n_tokens_neox': 655, 'n_words': 146}