Package entropy :: Module misc :: Class RSS

Class RSS

source code

This is a base class for handling RSS (XML) files through Python's xml.dom.minidom module. It produces 100% W3C-complaint code.

This class is meant to be used inside the Entropy world, it's not meant for other tasks outside this codebase.

Instance Methods
 
__init__(self, filename, title, description, maxentries=100)
RSS constructor
source code
 
add_item(self, title, link='', description='', pubDate='')
Add new entry to RSS feed.
source code
int
remove_entry(self, key)
Remove entry from RSS feed through its index number.
source code
tuple
get_entries(self)
Get entries and their total number.
source code
None
write_changes(self, reverse=True)
Writes changes to file.
source code
Method Details

__init__(self, filename, title, description, maxentries=100)
(Constructor)

source code 

RSS constructor

Parameters:
  • filename (string) - RSS file path (a new file will be created if not found)
  • title (string) - RSS feed title (used for new RSS files)
  • description (string) - RSS feed description (used for new RSS files)
  • maxentries (int) - max RSS feed entries

add_item(self, title, link='', description='', pubDate='')

source code 

Add new entry to RSS feed.

Parameters:
  • title (string) - entry title
  • link (string) - entry link
  • description (string) - entry description
  • pubDate (string) - entry publication date

remove_entry(self, key)

source code 

Remove entry from RSS feed through its index number.

Parameters:
  • key (int) - entry index number.
Returns: int
new entry count

get_entries(self)

source code 

Get entries and their total number.

Returns: tuple
tuple composed by items (list of dict) and total items count

write_changes(self, reverse=True)

source code 

Writes changes to file.

Parameters:
  • reverse (bool) - write entries in reverse order.
Returns: None
None