<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, render_template

from multiprocessing import Process
from init_logging import log_string
from Endpoint import Endpoint
from init_blinkt import blink

app = Flask(__name__)


class WebApp(Process):
    name = "Flask WebApp Process"

    def __init__(self):
        Process.__init__(self)
        self.app = app
        self.daemon = True

    def run(self):
        self.app.run(debug=True, host='0.0.0.0', port=4545)


@app.route('/api/node')
def get_unicorn_pi_data():
    blink('yellow')
    return jsonify(Endpoint().unicorn_pi_data())


@app.route('/api/sensors')
def get_sensor_data():
    blink('yellow')
    return jsonify(Endpoint().sensor_module_data())


@app.route('/api/rpi')
def get_rpi_stats():
    blink('yellow')
    return jsonify(Endpoint().rpi_stats())


@app.route('/')
def index():
    blink('yellow')
    return render_template('home.html')


@app.route('/node')
def node():
    blink('yellow')
    return render_template('node.html', node_data=Endpoint().unicorn_pi_data())


@app.route('/sensors')
def sensors():
    blink('yellow')
    return render_template('sensors.html', sensor_data=Endpoint().sensor_module_data())


@app.route('/rpi')
def rpi():
    blink('yellow')
    return render_template('rpi.html', rpi_data=Endpoint().rpi_stats())


# @app.route('/base')
# def base():
#     blink('yellow')
#     return render_template('base.html')


log_string('api endpoints created')<commit_msg>new feature: little bootstrap websites for the API Data<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, render_template

from multiprocessing import Process
from init_logging import log_string
from Endpoint import Endpoint

app = Flask(__name__)


class WebApp(Process):
    name = "Flask WebApp Process"

    def __init__(self):
        Process.__init__(self)
        self.app = app
        self.daemon = True

    def run(self):
        self.app.run(debug=True, host='0.0.0.0', port=4545)


@app.route('/api/node')
def get_unicorn_pi_data():
    return jsonify(Endpoint().unicorn_pi_data())


@app.route('/api/sensors')
def get_sensor_data():
    return jsonify(Endpoint().sensor_module_data())


@app.route('/api/rpi')
def get_rpi_stats():
    return jsonify(Endpoint().rpi_stats())


@app.route('/')
def index():
    return render_template('home.html')


@app.route('/node')
def node():
    return render_template('node.html', node_data=Endpoint().unicorn_pi_data())


@app.route('/sensors')
def sensors():
    return render_template('sensors.html', sensor_data=Endpoint().sensor_module_data())


@app.route('/rpi')
def rpi():
    return render_template('rpi.html', rpi_data=Endpoint().rpi_stats())


# @app.route('/base')
# def base():
#     blink('yellow')
#     return render_template('base.html')


log_string('api endpoints created')
{'fraction_non_alphanumeric': 0.1599861782999309, 'fraction_numerical': 0.006219765031098825, 'mean_word_length': 4.321691176470588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1408681', 'n_tokens_mistral': 987, 'n_tokens_neox': 945, 'n_words': 194}