Skip to main content

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

starlette-feedgen-0.1.3.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

starlette_feedgen-0.1.3-py3-none-any.whl (10.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page