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-metadata.mddocs/

Feed Metadata Management

Methods for setting and retrieving feed-level metadata including titles, descriptions, authors, links, categories and other feed properties for both ATOM and RSS formats.

Capabilities

Required Feed Metadata

Essential metadata required for valid ATOM and RSS feeds.

def title(self, title=None):
    """
    Set or get feed title.
    
    Args:
        title (str, optional): Feed title
        
    Returns:
        str or None: Current title if no argument provided
    """

def id(self, id=None):
    """
    Set or get feed ID/URL.
    
    Args:
        id (str, optional): Unique feed identifier URL
        
    Returns:
        str or None: Current ID if no argument provided
    """

def description(self, description=None):
    """
    Set or get feed description (RSS) / subtitle (ATOM).
    
    Args:
        description (str, optional): Feed description
        
    Returns:
        str or None: Current description if no argument provided
    """

def subtitle(self, subtitle=None):
    """
    Set or get feed subtitle (ATOM) / description (RSS).
    
    Args:
        subtitle (str, optional): Feed subtitle
        
    Returns:
        str or None: Current subtitle if no argument provided
    """

Author and Contributor Information

Manage feed authors and contributors with structured data.

def author(self, author=None, replace=False, **kwargs):
    """
    Set or get feed author(s).
    
    Args:
        author (dict or list, optional): Author information
        replace (bool): Replace existing authors instead of appending
        **kwargs: Author fields as keyword arguments
        
    Returns:
        list: Current authors if no argument provided
    """

def contributor(self, contributor=None, replace=False, **kwargs):
    """
    Set or get feed contributor(s).
    
    Args:
        contributor (dict or list, optional): Contributor information
        replace (bool): Replace existing contributors instead of appending
        **kwargs: Contributor fields as keyword arguments
        
    Returns:
        list: Current contributors if no argument provided
    """

Links and Relationships

Manage feed links including alternate URLs, self-references, and related resources.

def link(self, link=None, replace=False, **kwargs):
    """
    Set or get feed link(s).
    
    Args:
        link (dict or list, optional): Link information
        replace (bool): Replace existing links instead of appending
        **kwargs: Link fields as keyword arguments
        
    Returns:
        list: Current links if no argument provided
    """

Categories and Classification

Organize feeds with categories and taxonomy information.

def category(self, category=None, replace=False, **kwargs):
    """
    Set or get feed categories.
    
    Args:
        category (dict or list, optional): Category information
        replace (bool): Replace existing categories instead of appending
        **kwargs: Category fields as keyword arguments
        
    Returns:
        list: Current categories if no argument provided
    """

Visual Identity

Set logos, icons, and images for feed branding.

def logo(self, logo=None):
    """
    Set or get feed logo URL.
    
    Args:
        logo (str, optional): Logo image URL
        
    Returns:
        str or None: Current logo URL if no argument provided
    """

def icon(self, icon=None):
    """
    Set or get feed icon URL.
    
    Args:
        icon (str, optional): Icon image URL
        
    Returns:
        str or None: Current icon URL if no argument provided
    """

def image(self, url=None, title=None, link=None, width=None, height=None, description=None):
    """
    Set or get RSS feed image.
    
    Args:
        url (str, optional): Image URL
        title (str, optional): Image title
        link (str, optional): Image link URL
        width (int, optional): Image width in pixels
        height (int, optional): Image height in pixels
        description (str, optional): Image description
        
    Returns:
        dict or None: Current image info if no arguments provided
    """

Language and Locale

Set language and localization information.

def language(self, language=None):
    """
    Set or get feed language.
    
    Args:
        language (str, optional): Language code (e.g., 'en', 'en-US')
        
    Returns:
        str or None: Current language if no argument provided
    """

Timestamps

Manage feed update and publication timestamps.

def updated(self, updated=None):
    """
    Set or get feed updated timestamp (ATOM).
    
    Args:
        updated (datetime or str, optional): Last updated timestamp
        
    Returns:
        datetime or None: Current updated timestamp if no argument provided
    """

def lastBuildDate(self, lastBuildDate=None):
    """
    Set or get RSS lastBuildDate.
    
    Args:
        lastBuildDate (datetime or str, optional): Last build timestamp
        
    Returns:
        datetime or None: Current lastBuildDate if no argument provided
    """

def pubDate(self, pubDate=None):
    """
    Set or get RSS publication date.
    
    Args:
        pubDate (datetime or str, optional): Publication timestamp
        
    Returns:
        datetime or None: Current pubDate if no argument provided
    """

Rights and Legal

Manage copyright and rights information.

def rights(self, rights=None):
    """
    Set or get feed rights/copyright (ATOM).
    
    Args:
        rights (str, optional): Rights/copyright statement
        
    Returns:
        str or None: Current rights if no argument provided
    """

def copyright(self, copyright=None):
    """
    Set or get RSS copyright (alias for rights).
    
    Args:
        copyright (str, optional): Copyright statement
        
    Returns:
        str or None: Current copyright if no argument provided
    """

RSS-Specific Metadata

Additional metadata fields specific to RSS feeds.

def managingEditor(self, managingEditor=None):
    """
    Set or get RSS managing editor email.
    
    Args:
        managingEditor (str, optional): Managing editor email
        
    Returns:
        str or None: Current managing editor if no argument provided
    """

def webMaster(self, webMaster=None):
    """
    Set or get RSS webmaster email.
    
    Args:
        webMaster (str, optional): Webmaster email
        
    Returns:
        str or None: Current webmaster if no argument provided
    """

def ttl(self, ttl=None):
    """
    Set or get RSS time-to-live in minutes.
    
    Args:
        ttl (int, optional): TTL in minutes
        
    Returns:
        int or None: Current TTL if no argument provided
    """

def docs(self, docs=None):
    """
    Set or get RSS documentation URL.
    
    Args:
        docs (str, optional): Documentation URL
        
    Returns:
        str or None: Current docs URL if no argument provided
    """

def rating(self, rating=None):
    """
    Set or get RSS PICS rating.
    
    Args:
        rating (str, optional): PICS rating
        
    Returns:
        str or None: Current rating if no argument provided
    """

def skipHours(self, hours=None, replace=False):
    """
    Set or get RSS skipHours (hours to skip updates).
    
    Args:
        hours (list, optional): List of hours (0-23) to skip
        replace (bool): Replace existing hours instead of appending
        
    Returns:
        list or None: Current skipHours if no argument provided
    """

def skipDays(self, days=None, replace=False):
    """
    Set or get RSS skipDays (days to skip updates).
    
    Args:
        days (list, optional): List of days to skip ('Monday', 'Tuesday', etc.)
        replace (bool): Replace existing days instead of appending
        
    Returns:
        list or None: Current skipDays if no argument provided
    """

def textInput(self, title=None, description=None, name=None, link=None):
    """
    Set or get RSS textInput element.
    
    Args:
        title (str, optional): Text input title
        description (str, optional): Text input description
        name (str, optional): Text input name
        link (str, optional): Text input processing URL
        
    Returns:
        dict or None: Current textInput info if no arguments provided
    """

def cloud(self, domain=None, port=None, path=None, registerProcedure=None, protocol=None):
    """
    Set or get RSS cloud element for real-time notifications.
    
    Args:
        domain (str, optional): Domain where the webservice can be found
        port (int, optional): Port the webservice listens to
        path (str, optional): Path of the webservice
        registerProcedure (str, optional): Procedure to call
        protocol (str, optional): Protocol - 'HTTP-POST', 'XML-RPC', or 'SOAP 1.1'
        
    Returns:
        dict or None: Current cloud info if no arguments provided
    """

def generator(self, generator=None, version=None, uri=None):
    """
    Set or get feed generator metadata.
    
    Args:
        generator (str, optional): Software used to create the feed
        version (str, optional): Version of the software (ATOM only)
        uri (str, optional): URI where software can be found (ATOM only)
        
    Returns:
        dict or None: Current generator info if no arguments provided
    """

Usage Examples

Basic Feed Setup

from feedgen.feed import FeedGenerator

fg = FeedGenerator()

# Required metadata
fg.id('http://example.com/feed')
fg.title('My Technology Blog')
fg.description('Latest posts about web development and programming')

# Author information
fg.author({
    'name': 'John Doe',
    'email': 'john@example.com',
    'uri': 'http://johndoe.com'
})

# Multiple ways to set the same data
fg.author(name='Jane Smith', email='jane@example.com')  # kwargs
fg.author([{'name': 'Bob Wilson', 'email': 'bob@example.com'}])  # list

Links and Categories

# Add links
fg.link(href='http://example.com', rel='alternate')
fg.link(href='http://example.com/feed.atom', rel='self')

# Add categories
fg.category(term='technology', label='Technology')
fg.category([
    {'term': 'programming', 'label': 'Programming'},
    {'term': 'web-dev', 'label': 'Web Development'}
])

Visual Identity and Branding

# Set logo and icon
fg.logo('http://example.com/logo.png')
fg.icon('http://example.com/favicon.ico')

# RSS image
fg.image(
    url='http://example.com/banner.jpg',
    title='My Blog Banner',
    link='http://example.com',
    width=400,
    height=100
)

Timestamps and Updates

from datetime import datetime
import dateutil.tz

now = datetime.now(dateutil.tz.tzutc())

fg.updated(now)
fg.lastBuildDate(now)
fg.pubDate(now)

# String timestamps are also supported
fg.updated('2023-12-01T10:30:00Z')

RSS-Specific Advanced Features

# RSS cloud for real-time notifications  
fg.cloud(
    domain='example.com',
    port=80,
    path='/rsscloud',
    registerProcedure='notify',
    protocol='HTTP-POST'
)

# Generator metadata
fg.generator(
    generator='MyFeedApp',
    version='1.2.0',
    uri='https://example.com/myfeedapp'
)

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