import on_this_day import sys import sqlite3 from datetime import datetime from config import config from http.server import HTTPServer, BaseHTTPRequestHandler def format_datetime(date): return str(date) def generate_item(item): return f""" <![CDATA[{item["title"]}]]> {config["host"]}/{item["guid"]} {item["guid"]} {item["createdAt"]} """ def generate_feed(items): return f""" On This Day Daily posts of stuff for today {format_datetime(datetime.now())} {"".join(generate_item(item) for item in items)} """ def generate_ul(items): return f"""