Skip to content

nathan-osman/rss2producer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rss2producer

Build Status Coverage PyPI Version PyPI Downloads License

This package provides a Python script with an extremely simple class for generating an RSS 2.0 feed. With just a couple lines of Python code, your script can create an RSS 2.0 feed and add items to it.

Installation

You can install rss2producer via PIP using the following command:

pip install rss2producer

Usage

Once installed, you can import the RSS2Feed class with the following line:

from rss2producer import RSS2Feed

To create a feed, simply use the RSS2Feed constructor:

feed = RSS2Feed(
    title='A Simple Title',
    link='http://example.org',
    description='A longer description of the feed contents.'
)

After the feed is created, you can add items with the append_item method:

feed.append_item(
    title='Sample Item',
    link='http://example.org/sample-item',
    description='A longer description of the sample item.',
    pub_date=datetime.utcnow()
)

At a minimum, title or description must be included; all other parameters are optional. The pub_date parameter can be either a datetime instance or a UTC timestamp.

When all of the items have been added to the feed, the XML contents can be obtained with:

feed.get_xml()

About

Python package to simplify the creation of RSS 2.0 feeds.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages