Welcome to GenRSS!

This is generator of rss feed for your channel. Easy for config and usage.

Get started with Installation and then get an overview with the Quickstart. The rest of the docs describe each component of GenRSS in detail, with a full reference in the API section.

User’s Guide

Installation

Python Version

We recommend using the latest version of Python 3. GenRSS supports Python 3.6 and newer.

Dependencies

These distributions will be installed automatically when installing GenRSS.

  • lxml==4.3.4
  • pytz==2019.1

Install GenRSS

Use the following command to install GenRSS:

pip install -U genrss

GenRSS is now installed. Check out Quickstart

Install from source

If you want to work with the latest GenRSS code before it’s released, install or update the code from the master branch:

pip install -U https://github.com/icetemple/genrss/archive/master.zip

Quickstart

Do you want to get started? This page gives a good introduction to GetRSS. It assumes you already have GenRSS installed. If you do not, head over to the Installation section.

A Simple Example

from datetime import datetime
from genrss import GenRSS

feed = GenRSS(title='SmartFridge',
              site_url='https://smartfridge.me',
              feed_url='https://smartfridge.me/feed/rss.xml')

feed.item(title='black buns for burgers',
          description='For the first time black burgers appeared ' \
                      'in Japan. Unusual dark color buns complemented ' \
                      'with black cheese and sauce. Over time, the dish ' \
                      'has conquered the whole world. The main secret ' \
                      'ingredient in popular buns is the most common... ' \
                      'charcoal!',
          url='https://smartfridge.me/recipe/316b28-chernye-bulochki-dlya-burgerov/',
          author='@smartfridge',
          categories=['baking'],
          pub_date=datetime.utcnow())

xml = feed.xml()

This code initializes small feed about recipe site with one item and returns xml as string

For more information about GenRSS you can have a look API section.

API Reference

If you are looking for information on a specific function, class or method, this part of the documentation is for you.

API

GenRSS

class genrss.GenRSS(title: str, site_url: str, feed_url: str, **kwargs)

Generates RSS feed of channel.

Parameters:
  • title – Title of your site or feed
  • site_url – Absolute url to the site that the feed is for
  • feed_url – Absolute url to the rss feed
  • description – A short description of feed
  • image_url – Image absolute url for channel
  • image – Image element for channel (it replaces image_url)
  • author – Author of channel
  • pub_date – Datetime in utc when last item was published
  • copyright – Copyright information for this feed
  • language – The language of the content of this feed.
  • editor – Who manages content in this feed
  • webmaster – Who manages feed availability and technical support
  • docs_url – Url to rss documentation
  • categories – List of category names
  • generator – Feed generator
item(title: str, **kwargs)

Adds item to the feed.

An item can be used for recipes, blog entries, project update, log entry, etc. Your RSS feed can have any number of items.

Parameters:
  • title – Title of this particular item
  • description – Content for the item. Can contain html but link and image urls must be absolute path including hostname
  • url – Url to the item. This could be a blog entry
  • guid – A unique string feed readers use to know if an item is new or has already been seen. If you use a guid never change it. If you don’t provide a guid then your item urls must be unique
  • author – If included it is the name of the item’s creator. If not provided the item author will be the same as the feed author. This is typical except on multi-author blogs
  • categories – If provided, each array item will be added as a category element
  • enclosure – An enclosure object
  • pub_date – The date and time of when the item was created. Feed readers use this to determine the sort order. Some readers will also use it to determine if the content should be presented as unread
to_element() → ElementT

Returns root element for xml.

xml(pretty: bool = False) → str

Returns the XML as a string.

Parameters:pretty – Pretty print xml

Item

class genrss.Item(title: str, **kwargs)

Data for item tag for rss.

Parameters:
  • title – Title of this particular item
  • description – Content for the item. Can contain html but link and image urls must be absolute path including hostname
  • url – Url to the item. This could be a blog entry
  • guid – A unique string feed readers use to know if an item is new or has already been seen. If you use a guid never change it. If you don’t provide a guid then your item urls must be unique
  • author – If included it is the name of the item’s creator. If not provided the item author will be the same as the feed author. This is typical except on multi-author blogs
  • categories – If provided, each array item will be added as a category element
  • enclosure – An enclosure object
  • image – An image object
  • pub_date – The date and time of when the item was created. Feed readers use this to determine the sort order. Some readers will also use it to determine if the content should be presented as unread
to_element() → ElementT

Returns item element for xml.

Enclosure

class genrss.Enclosure(url: str, size=None, type=None)

Data for enclosure tag for rss.

Parameters:
  • url – Absolute url to file
  • size – File size
  • type – File mime type
classmethod from_dict(data: Dict[str, Union[str, int]])

Makes enclosure data from dict.

to_element() → ElementT

Returns item element for xml.

Additional notes

legal information and changelog are here for the interested.

Changelog

Version 1.0.5

Released 2020-11-06

  • Update lxml version

Version 1.0.3

Released 2019-07-30

  • Added Item and Enclosure objects.
  • Fixed bug with encodings.

Version 1.0.0

Released 2019-07-23

  • First public preview release.