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.