summaryrefslogtreecommitdiff
path: root/src/technical_renaissance
diff options
context:
space:
mode:
Diffstat (limited to 'src/technical_renaissance')
-rw-r--r--src/technical_renaissance/app.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/technical_renaissance/app.py b/src/technical_renaissance/app.py
index 6d63180..5519027 100644
--- a/src/technical_renaissance/app.py
+++ b/src/technical_renaissance/app.py
@@ -4,6 +4,7 @@ import random
import tomllib
from pathlib import Path
from typing import TypedDict
+from xml.etree import ElementTree
from robyn import Request, Response, Robyn
from robyn.templating import JinjaTemplate
@@ -65,4 +66,21 @@ async def random_user(_request: Request):
return redirect(random.choice(users)["url"])
+def build_opml() -> str:
+ opml = ElementTree.Element("opml", version="2.0")
+ head = ElementTree.SubElement(opml, "head")
+ ElementTree.SubElement(head, "title").text = "Technical Renaissance Webring"
+ body = ElementTree.SubElement(opml, "body")
+ for user in users:
+ if user["feed"]:
+ ElementTree.SubElement(
+ body,
+ "outline",
+ text=user["name"],
+ type="rss",
+ xmlUrl=user["feed"],
+ htmlUrl=user["url"],
+ )
+ return ElementTree.tostring(opml, encoding="unicode", xml_declaration=True)
+
app.start(host="127.0.0.1", port=8080)