<commit_before>#!flask/bin/python
"""
RESTful API
"""
from flask import Flask, jsonify
from cp_validator.root.extractor import get_postal

postals = get_postal()

app = Flask(__name__)

@app.route('/cp/api/v1.0/codigos', methods=['GET'])
def get_tasks():
    return jsonify(postals)

if __name__ == '__main__':
    app.run(debug=True)<commit_msg>entry point for single code<commit_after>#!flask/bin/python
"""
RESTful API
"""
from flask import Flask, jsonify, abort
from cp_validator.root.extractor import get_postal

postals = get_postal()

app = Flask(__name__)

@app.route('/cp/api/v1.0/codigos', methods=['GET'])
def get_postals():
    return jsonify(postals)

@app.route('/cp/api/v1.0/codigos/<codigo>', methods=['GET'])
def get_cp(codigo):
    if codigo not in postals:
        abort(404)
    return jsonify({codigo: postals[codigo]})

if __name__ == '__main__':
    app.run(debug=True)
{'fraction_non_alphanumeric': 0.15695067264573992, 'fraction_numerical': 0.010089686098654708, 'mean_word_length': 4.993288590604027, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '5798872', 'n_tokens_mistral': 339, 'n_tokens_neox': 335, 'n_words': 69}