CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-feedgen

Python library for generating web feeds in both ATOM and RSS formats with extensible support for specialized feed formats

Pending
Overview
Eval results
Files

feed-generation.mddocs/

Feed Generation

Core functionality for creating FeedGenerator instances and generating ATOM and RSS feed output in various formats.

Capabilities

FeedGenerator Class

The main class for creating and configuring web feeds.

class FeedGenerator:
    def __init__(self):
        """
        Create a new FeedGenerator instance.
        
        Initializes empty feed with default generator metadata.
        """

ATOM Feed Generation

Generate ATOM 1.0 format feeds as strings or files.

def atom_str(self, pretty=False, extensions=True, encoding='UTF-8', xml_declaration=True):
    """
    Generate ATOM feed as string.
    
    Args:
        pretty (bool): Pretty print XML with indentation
        extensions (bool): Include loaded extensions in output
        encoding (str): Character encoding for output
        xml_declaration (bool): Include XML declaration in output
        
    Returns:
        bytes: ATOM feed XML as encoded bytes
    """

def atom_file(self, filename, extensions=True, pretty=False, encoding='UTF-8', xml_declaration=True):
    """
    Write ATOM feed to file.
    
    Args:
        filename (str): Output file path
        extensions (bool): Include loaded extensions in output  
        pretty (bool): Pretty print XML with indentation
        encoding (str): Character encoding for output
        xml_declaration (bool): Include XML declaration in output
        
    Returns:
        str: The filename that was written
    """

RSS Feed Generation

Generate RSS 2.0 format feeds as strings or files.

def rss_str(self, pretty=False, extensions=True, encoding='UTF-8', xml_declaration=True):
    """
    Generate RSS feed as string.
    
    Args:
        pretty (bool): Pretty print XML with indentation
        extensions (bool): Include loaded extensions in output
        encoding (str): Character encoding for output
        xml_declaration (bool): Include XML declaration in output
        
    Returns:
        bytes: RSS feed XML as encoded bytes
    """

def rss_file(self, filename, extensions=True, pretty=False, encoding='UTF-8', xml_declaration=True):
    """
    Write RSS feed to file.
    
    Args:
        filename (str): Output file path
        extensions (bool): Include loaded extensions in output
        pretty (bool): Pretty print XML with indentation  
        encoding (str): Character encoding for output
        xml_declaration (bool): Include XML declaration in output
        
    Returns:
        str: The filename that was written
    """

Usage Examples

Basic Feed Generation

from feedgen.feed import FeedGenerator

fg = FeedGenerator()
fg.id('http://example.com/feed')
fg.title('My Feed')
fg.author({'name': 'Author Name', 'email': 'author@example.com'})
fg.link(href='http://example.com', rel='alternate')
fg.description('Feed description')
fg.language('en')

# Generate pretty-printed ATOM feed
atom_feed = fg.atom_str(pretty=True)
print(atom_feed.decode('utf-8'))

# Generate RSS feed  
rss_feed = fg.rss_str(pretty=True)
print(rss_feed.decode('utf-8'))

File Output

# Write feeds to files
fg.atom_file('output.atom', pretty=True)
fg.rss_file('output.rss', pretty=True)

# Generate without extensions
atom_no_ext = fg.atom_str(extensions=False)
rss_no_ext = fg.rss_str(extensions=False)

Custom Encoding

# Generate with different encoding
atom_utf16 = fg.atom_str(encoding='UTF-16', pretty=True)
fg.atom_file('feed_utf16.atom', encoding='UTF-16')

Install with Tessl CLI

npx tessl i tessl/pypi-feedgen

docs

entry-management.md

extensions.md

feed-generation.md

feed-metadata.md

index.md

tile.json