<commit_before>from random import randint
from flask import Flask, request
from slack_bot import Bot
from persist import Persistence


app = Flask(__name__)


@app.route("/healthcheck", methods=['GET'])
def health_check():
    key, value = 'HEALTH_CHECK', randint(0, 100000)
    try:
        persistence = Persistence()
        persistence.client.set(key, value)
        assert int(persistence.client.get(key)) == value
        persistence.client.delete(key)
    except Exception as e:
        return 'WARNING - REDIS - {}'.format(e), 500

    try:
        bot = Bot()
        assert len(bot.my_channels) > 0
    except Exception as e:
        return 'WARNING - SLACK - {}'.format(e), 500

    return 'WORKING', 200


@app.route("/notify", methods=['POST'])
def send_notification():
    content = request.get_json()
    message = content.get('message', '')
    if not message:
        return 'Content must have message field', 400

    try:
        Bot().send_message(message)
    except Exception as e:
        return e, 400
    else:
        return 'OK', 201


if __name__ == "__main__":
    app.run(debug=True)<commit_msg>Creating API route to check status of API<commit_after>from random import randint
from flask import Flask, request
from slack_bot import Bot
from persist import Persistence


app = Flask(__name__)


@app.route("/healthcheck", methods=['GET'])
def health_check():
    key, value = 'HEALTH_CHECK', randint(0, 100000)
    try:
        persistence = Persistence()
        persistence.client.set(key, value)
        assert int(persistence.client.get(key)) == value
        persistence.client.delete(key)
    except Exception as e:
        return 'WARNING - REDIS - {}'.format(e), 500

    try:
        bot = Bot()
        assert len(bot.my_channels) > 0
    except Exception as e:
        return 'WARNING - SLACK - {}'.format(e), 500

    return 'WORKING', 200


@app.route("/healthcheck/api", methods=['GET'])
def health_check_api():
    return 'WORKING', 200


@app.route("/notify", methods=['POST'])
def send_notification():
    content = request.get_json()
    message = content.get('message', '')
    if not message:
        return 'Content must have message field', 400

    try:
        Bot().send_message(message)
    except Exception as e:
        return e, 400
    else:
        return 'OK', 201


if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True)
{'fraction_non_alphanumeric': 0.1274018379281537, 'fraction_numerical': 0.024644945697577275, 'mean_word_length': 2.9133986928104574, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '721541', 'n_tokens_mistral': 786, 'n_tokens_neox': 709, 'n_words': 212}