import requests import os import json # Replace with a known-404 page for whatever you want. Doing this so the nginx version is accurate. url_404 = 'https://askiiart.net/sdlfjsadljfs' html_404 = str(requests.get(url_404).text) boykisser_url = 'https://askiiart.net/assets/boykisser.png' gandalf_url = '/you.gif' try: os.mkdir('pages') except FileExistsError: pass with open('status-codes.json', 'r') as codes_file: codes_dict = json.load(codes_file) for code in codes_dict: new_html = html_404.replace('404 Not Found', f'{code} {codes_dict[code]}') if code == "404": new_html = new_html.replace("