diff options
author | André Glüpker <git@wgmd.de> | 2024-05-01 10:20:30 +0200 |
---|---|---|
committer | André Glüpker <git@wgmd.de> | 2024-05-01 10:20:30 +0200 |
commit | b335495aadc9f5116a88d0359087ae33c9524aed (patch) | |
tree | 674f79b4dea91d17d56bf4a23ef91f5e689df347 /rss.py | |
parent | 121f1890b1618c92d7a8fc6d174881e66ab6b7c1 (diff) | |
download | rss-feeds-b335495aadc9f5116a88d0359087ae33c9524aed.tar.gz rss-feeds-b335495aadc9f5116a88d0359087ae33c9524aed.tar.bz2 rss-feeds-b335495aadc9f5116a88d0359087ae33c9524aed.zip |
Fix dataclass usage
Diffstat (limited to 'rss.py')
-rwxr-xr-x | rss.py | 30 |
1 files changed, 2 insertions, 28 deletions
@@ -1,8 +1,9 @@ #!/usr/bin/env python3 -from dataclasses import dataclass from datetime import datetime +from rss_types import RSSFeed + def _format_date(dt): """convert a datetime into an RFC 822 formatted date @@ -50,39 +51,12 @@ def _format_date(dt): ) -@dataclass -class RSSItem: - title: str - url: str - content: str - date: str - enclosures: list[str] - guid: str - - -@dataclass -class RSSFeed: - title: str - url: str - description: str - content: list[RSSItem] - - def escape(str): str = str.replace("&", "&") return str def buildRSS(feed_data: RSSFeed): - """ - feed_data = { - title, url, description, - content = [{ - title, url, content, date, [enclosures], guid - }] - } - """ - feed = f"""<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> |