aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/generate_500.py
blob: a415a39c61d0f7105819afe60646862337a7d46a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3

from base64 import b64encode
from string import Template
import os


script_dir = os.path.dirname(__file__)

template = ''
css = ''
logo = ''

with open(os.path.join(script_dir, '../internal_error.in.html'), 'r') as template:
    template = template.read()

with open(os.path.join(script_dir, '../assets/styles.css'), 'r') as f:
    css = f.read()

with open(os.path.join(script_dir, '../assets/logo.svg'), 'r') as f:
    logo = b64encode(f.read().encode('utf-8'))

template = Template(template)
html = template.substitute(
    CSS=css,
    LOGO_DATA=logo,
)

print(html, end='')