#!/usr/bin/env python3 import http.server class MyHTTPRequestHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): tfile = open('/sys/class/thermal/thermal_zone0/temp', 'r') temperature = float(tfile.read()) / 1000 tfile.close() netfile = open('/sys/class/net/eth0/statistics/tx_packets', 'r') tpkts = int(netfile.read()) netfile.close() netfile = open('/sys/class/net/eth0/statistics/rx_packets', 'r') rpkts = int(netfile.read()) netfile.close() netfile = open('/sys/class/net/eth0/statistics/tx_bytes', 'r') tbytes = int(netfile.read()) netfile.close() netfile = open('/sys/class/net/eth0/statistics/rx_bytes', 'r') rbytes = int(netfile.read()) netfile.close() self.send_response(200, "OK") self.send_header("Content-Type", "text/html; charset=UTF-8") self.end_headers() output = """