askrobots / dbbasic-rss
Public
RSS feeds from TSV, CSV, JSON or Python lists, for any Python web framework or a static site.
__init__.py · 1.3 KB · 53 lines
| 1 | """ |
| 2 | dbbasic-rss: Simple, composable RSS feed generation for Python |
| 3 | |
| 4 | A Unix-philosophy approach to RSS feeds: |
| 5 | - Read from simple data sources (TSV, CSV, JSON, lists) |
| 6 | - Generate standards-compliant RSS 2.0 |
| 7 | - Framework-agnostic (works with Flask, Django, FastAPI, static sites) |
| 8 | - No heavy dependencies |
| 9 | - Composable with dbbasic-tsv and other modules |
| 10 | |
| 11 | Quick Start: |
| 12 | # One-liner |
| 13 | import dbbasic_rss as rss |
| 14 | rss.generate('articles.tsv', 'feed.xml') |
| 15 | |
| 16 | # From TSV (works with dbbasic-tsv) |
| 17 | feed = rss.from_tsv('articles.tsv', |
| 18 | title='My Blog', |
| 19 | url_pattern='https://example.com/{slug}/') |
| 20 | feed.write('feed.xml') |
| 21 | |
| 22 | # From list of dicts |
| 23 | posts = [{'title': 'Post 1', 'date': '2025-10-19', 'url': 'https://...'}] |
| 24 | feed = rss.from_posts(posts) |
| 25 | print(feed.to_xml()) |
| 26 | |
| 27 | # Custom feed |
| 28 | feed = rss.Feed(title='My Blog', link='https://example.com') |
| 29 | feed.add_post(title='Article', link='https://example.com/article/') |
| 30 | feed.write('feed.xml') |
| 31 | """ |
| 32 | |
| 33 | from .feed import Feed, FeedItem |
| 34 | from .generators import ( |
| 35 | from_posts, |
| 36 | from_tsv, |
| 37 | from_csv, |
| 38 | from_json, |
| 39 | from_directory, |
| 40 | generate, |
| 41 | ) |
| 42 | |
| 43 | __version__ = "1.0.0" |
| 44 | __all__ = [ |
| 45 | "Feed", |
| 46 | "FeedItem", |
| 47 | "from_posts", |
| 48 | "from_tsv", |
| 49 | "from_csv", |
| 50 | "from_json", |
| 51 | "from_directory", |
| 52 | "generate", |
| 53 | ] |