RSS/Atom feeds generation for Starlette, adapted from Django syndication feed framework
Project description
Starlette FeedGen
RSS/Atom feeds generation for Starlette, adapted from Django syndication feed framework.
Installation
pip install starlette-feedgen
Usage
from typing import NamedTuple
from starlette.applications import Starlette
from starlette_feedgen import FeedEndpoint
class FeedItem(NamedTuple):
title = 'Hello'
description = 'There'
link = 'http://example.com/article'
app = Starlette()
@app.route('/feed')
class Feed(FeedEndpoint):
title = 'Example RSS Feed'
description = 'With example item'
link = 'http://example.com'
async def get_items(self):
yield FeedItem()
Example RSS Output:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Example RSS Feed</title>
<link>http://example.com</link>
<description>With example item</description>
<atom:link rel="self" href="/feed"></atom:link>
<lastBuildDate>Wed, 27 May 2020 13:38:55 +0000</lastBuildDate>
<item>
<title>Hello</title>
<link>http://example.com/article</link>
<description>There</description>
<guid>http://example.com/article</guid>
</item>
</channel>
</rss>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for starlette_feedgen-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e3c160d46feb39cc416662bf2d985f09ba63d25f0aed289c9ed058b8d3e92c |
|
MD5 | 4101ccd6062d04acf450795b0f1bb98a |
|
BLAKE2b-256 | c0aa96bb7705ec3a24bc313697b0e989f49634a97464dd3458cfedc01b49d306 |