<commit_before>#!/usr/bin/env python
#coding: utf-8

from flask import Flask
from flask.ext import restful
from flask.ext.sqlalchemy import SQLAlchemy
from tyr import resources

from tyr.app import app, db, api

api.add_resource(resources.Instance, '/20131022/instances/')
api.add_resource(resources.Api, '/20131022/apis/')
api.add_resource(resources.User, '/20131022/users/', '/20131022/user/',
        '/20131022/user/<int:user_id>/', '/20131022/user/<string:login>/')
api.add_resource(resources.Key, '/20131022/user/<int:user_id>/keys/',
        '/20131022/user/<int:user_id>/key/',
        '/20131022/user/<int:user_id>/key/<int:key_id>/')

api.add_resource(resources.Authorization,
        '/20131022/user/<int:user_id>/authorization/',
        '/20131022/user/<int:user_id>/authorizations/')

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')<commit_msg>Tyr: ajout d'un handler d'exception pour les logs<commit_after>#!/usr/bin/env python
#coding: utf-8

from flask import Flask
from flask.ext import restful
from flask.ext.sqlalchemy import SQLAlchemy
from tyr import resources

from tyr.app import app, db, api

api.add_resource(resources.Instance, '/20131022/instances/')
api.add_resource(resources.Api, '/20131022/apis/')
api.add_resource(resources.User, '/20131022/users/', '/20131022/user/',
        '/20131022/user/<int:user_id>/', '/20131022/user/<string:login>/')
api.add_resource(resources.Key, '/20131022/user/<int:user_id>/keys/',
        '/20131022/user/<int:user_id>/key/',
        '/20131022/user/<int:user_id>/key/<int:key_id>/')

api.add_resource(resources.Authorization,
        '/20131022/user/<int:user_id>/authorization/',
        '/20131022/user/<int:user_id>/authorizations/')

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')


@app.errorhandler(Exception)
def error_handler(exception):
    """
    se charge de générer la réponse d'erreur au bon format
    """
    app.logger.exception('')
{'fraction_non_alphanumeric': 0.17135549872122763, 'fraction_numerical': 0.09514066496163683, 'mean_word_length': 4.2439678284182305, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7620872', 'n_tokens_mistral': 839, 'n_tokens_neox': 710, 'n_words': 114}