diff options
Diffstat (limited to 'scripts/generate_500.py')
-rwxr-xr-x | scripts/generate_500.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/generate_500.py b/scripts/generate_500.py new file mode 100755 index 0000000..a415a39 --- /dev/null +++ b/scripts/generate_500.py @@ -0,0 +1,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='') |