<commit_before># -*- coding: utf-8 -*-

"""
km-hipchat-screamer.statuspage
~~~~~~~~~~~~~~~~~~~~~~~

Module providing for status change alert routes the KISSmetrics HipChat Webhook service
"""


from flask import Blueprint, jsonify, request
from utils import env_check
import os
import json
import hipchat
import requests

hipchat_notification_color = { 'operational': 'green',
                               'degraded_performance': 'yellow',
                               'partial_outage': 'yellow',
                               'major_outage': 'red',
                               'investigating': 'red',
                               'identified': 'yellow',
                               'monitoring': 'gray',
                               'resolved': 'green' }

def get_component_name(page_id, component_id):
    url = 'http://%s.statuspage.io/index.json' % (page_id)
    response = requests.get(url)
    data = response.json()
    for component in data['components']:
        if component['id'] == component_id:
            return component['name']


STATUSPAGE_HIPCHAT_TOKEN = os.environ.get('STATUSPAGE_HIPCHAT_TOKEN')
STATUSPAGE_NOTIFY_ROOMS = os.environ.get('STATUSPAGE_NOTIFY_ROOMS')

statuspage = Blueprint('statuspage', __name__)

#-------
# Routes
#-------

@statuspage.route('/dump', methods=['POST'])
def dump():
    return jsonify({'OK'})


@statuspage.route('/statuspage/alert', methods=['POST'])<commit_msg>add color for scheduled tasks<commit_after># -*- coding: utf-8 -*-

"""
km-hipchat-screamer.statuspage
~~~~~~~~~~~~~~~~~~~~~~~

Module providing for status change alert routes the KISSmetrics HipChat Webhook service
"""


from flask import Blueprint, jsonify, request
from utils import env_check
import os
import json
import hipchat
import requests

hipchat_notification_color = { 'operational': 'green',
                               'degraded_performance': 'yellow',
                               'partial_outage': 'yellow',
                               'major_outage': 'red',
                               'scheduled': 'gray',
                               'investigating': 'red',
                               'identified': 'yellow',
                               'monitoring': 'gray',
                               'resolved': 'green' }

def get_component_name(page_id, component_id):
    url = 'http://%s.statuspage.io/index.json' % (page_id)
    response = requests.get(url)
    data = response.json()
    for component in data['components']:
        if component['id'] == component_id:
            return component['name']


STATUSPAGE_HIPCHAT_TOKEN = os.environ.get('STATUSPAGE_HIPCHAT_TOKEN')
STATUSPAGE_NOTIFY_ROOMS = os.environ.get('STATUSPAGE_NOTIFY_ROOMS')

statuspage = Blueprint('statuspage', __name__)

#-------
# Routes
#-------

@statuspage.route('/dump', methods=['POST'])
def dump():
    return jsonify({'OK'})


@statuspage.route('/statuspage/alert', methods=['POST'])
{'fraction_non_alphanumeric': 0.14607508532423208, 'fraction_numerical': 0.0006825938566552901, 'mean_word_length': 2.392361111111111, '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': '6417800', 'n_tokens_mistral': 835, 'n_tokens_neox': 814, 'n_words': 177}