From f73f2356820468344757dbb9d7f3ec73ece7bf66 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 13 Feb 2023 20:43:51 +0100 Subject: Updating. Signed-off-by: Daniel Baumann --- web/tools.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 web/tools.py (limited to 'web/tools.py') diff --git a/web/tools.py b/web/tools.py new file mode 100755 index 0000000..cde194a --- /dev/null +++ b/web/tools.py @@ -0,0 +1,26 @@ +#!/usr/bin/python3.10 + +import platform + +def print_html(htmlfile, host_name): + with open(htmlfile, 'r') as f: + html = f.read() + + print(html.format(**locals())) + +def get_host_name(): + host_name = platform.node() + + return host_name + +def main(): + host_name = get_host_name() + + print('Content-Type: text/html\n') + print_html('html/header.html.in', host_name) + print_html('html/footer.html', host_name) + + exit(0) + +if __name__ == '__main__': + main() -- cgit v1.2.3