<commit_before>#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
'''
__title__ = ''
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__mtime__ = '13/08/15'
'''
import hashlib

from app.models import Users
from app import api
from flask import abort
from flask.ext.restful import Resource, reqparse


class AuthAPI(Resource):
    '''!Using username and password to exchange a token for DataSink,
    almost operating need this token
    '''

    def __init__(self):
        self.reqparse = reqparse.RequestParser()
        self.reqparse.add_argument('username', type=str, required=True, help='No username provide', location='json')
        self.reqparse.add_argument('password', type=str, required=True, help='No password provide', location='json')
        self.args = self.reqparse.parse_args()
        super(AuthAPI, self).__init__()

    def post(self):
        '''!Post a json object which includes username and password to exchange a token
        {
            "username":"testuser",
            "password":"<PASSWORD>"
        }
        :return: status code 200 - {"token":"<KEY>"}<commit_msg>Unnecessary contact information removed<commit_after>#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
'''
__title__ = ''
__mtime__ = '13/08/15'
'''
import hashlib

from app.models import Users
from app import api
from flask import abort
from flask.ext.restful import Resource, reqparse


class AuthAPI(Resource):
    '''!Using username and password to exchange a token for DataSink,
    almost operating need this token
    '''

    def __init__(self):
        self.reqparse = reqparse.RequestParser()
        self.reqparse.add_argument('username', type=str, required=True, help='No username provide', location='json')
        self.reqparse.add_argument('password', type=str, required=True, help='No password provide', location='json')
        self.args = self.reqparse.parse_args()
        super(AuthAPI, self).__init__()

    def post(self):
        '''!Post a json object which includes username and password to exchange a token
        {
            "username":"testuser",
            "password":"<PASSWORD>"
        }
        :return: status code 200 - {"token":"<KEY>"}
{'fraction_non_alphanumeric': 0.13099630996309963, 'fraction_numerical': 0.01107011070110701, 'mean_word_length': 3.3207171314741037, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 9, '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': '896914', 'n_tokens_mistral': 634, 'n_tokens_neox': 611, 'n_words': 180}