### Podcast Extension Example Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Provides an example of using the podcast extension to generate a podcast-friendly RSS feed. It includes loading the extension, setting iTunes categories, and adding an entry with an enclosure URL, size, and MIME type. ```python from feedgen.feed import FeedGenerator fg = FeedGenerator() fg.load_extension('podcast') fg.podcast.itunes_category('Technology', 'Podcasting') fe = fg.add_entry() fe.id('http://lernfunk.de/media/654321/1/file.mp3') fe.title('The First Episode') fe.description('Enjoy our first episode.') fe.enclosure('http://lernfunk.de/media/654321/1/file.mp3', 0, 'audio/mpeg') ``` -------------------------------- ### Install python-feedgen using pip Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Installs the feedgen module using pip, the standard Python package installer. This is a common method for installing Python libraries. ```bash pip install feedgen ``` -------------------------------- ### Create and Configure a Feed Generator Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Demonstrates how to instantiate the FeedGenerator class and set essential feed metadata such as ID, title, author, links, logo, and language. It shows common methods for setting single-value fields. ```python from feedgen.feed import FeedGenerator fg = FeedGenerator() fg.id('http://lernfunk.de/media/654321') fg.title('Some Testfeed') fg.author( {'name':'John Doe','email':'john@example.de'} ) fg.link( href='http://example.com', rel='alternate' ) fg.logo('http://ex.com/logo.jpg') fg.subtitle('This is a cool feed!') fg.link( href='http://larskiesow.de/test.atom', rel='self' ) fg.language('en') ``` -------------------------------- ### Test Feedgen Module Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Executes the feedgen module from the command line, typically used for testing or running the library's main functionality. ```shell $ python -m feedgen ``` -------------------------------- ### Generate ATOM and RSS Feeds Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Shows how to generate the feed content in ATOM and RSS formats. It covers obtaining the feed as a string with pretty-printing and writing the feed directly to files. ```python atomfeed = fg.atom_str(pretty=True) # Get the ATOM feed as string rssfeed = fg.rss_str(pretty=True) # Get the RSS feed as string fg.atom_file('atom.xml') # Write the ATOM feed to a file fg.rss_file('rss.xml') # Write the RSS feed to a file ``` -------------------------------- ### Generate RSS Output Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Demonstrates how to generate RSS output from a FeedGenerator instance, either as a formatted string or by saving to a file. ```python fg.rss_str(pretty=True) fg.rss_file('podcast.xml') ``` -------------------------------- ### Load Feed Extensions Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Demonstrates how to load extensions for the FeedGenerator, which allows for adding custom or standard data to the feed's XML structure. The `atom` and `rss` parameters control feed type compatibility. ```python fg.load_extension('someext', atom=True, rss=True) ``` -------------------------------- ### Feedgen Base Extension Module Documentation Source: https://github.com/lkiesow/python-feedgen/blob/main/doc/ext/api.ext.base.rst This section documents the base extension module for the python-feedgen library. It includes all public members of the module, providing details on their functionality, parameters, and usage. ```APIDOC feedgen.ext.base Module Documentation: This module is documented using Sphinx's automodule directive with the :members: option, indicating that all public members (classes, functions, variables) are exposed and documented. Dependencies: - Python standard library - Other modules within the feedgen library Usage: This module serves as a foundation for feed generation extensions. Specific classes and functions within it would be imported and utilized by other parts of the feedgen library or by users extending its functionality. Example (Conceptual): ```python from feedgen.ext.base import BaseExtension class MyCustomExtension(BaseExtension): def __init__(self, config): super().__init__(config) # Custom initialization def process_feed(self, feed): # Logic to modify the feed pass ``` Note: The actual members and their detailed API specifications are not provided in the input text, but the directive implies their existence and documentation within the source project. ``` -------------------------------- ### Add Contributors to Feed Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Illustrates various ways to add contributor information to a feed. Contributors can be added individually using keyword arguments or dictionaries, or multiple contributors can be added using a list of dictionaries. ```python fg.contributor( name='John Doe', email='jdoe@example.com' ) fg.contributor({'name':'John Doe', 'email':'jdoe@example.com'}) fg.contributor([{'name':'John Doe', 'email':'jdoe@example.com'}, ...]) ``` -------------------------------- ### Add Entries to Feed Source: https://github.com/lkiesow/python-feedgen/blob/main/readme.rst Explains how to add individual entries (items) to the feed. The `add_entry` method creates and returns a `FeedEntry` object, which can then be populated with details like ID, title, and links. ```python fe = fg.add_entry() fe.id('http://lernfunk.de/media/654321/1') fe.title('The First Episode') fe.link(href="http://lernfunk.de/feed") ``` -------------------------------- ### Feedgen API Documentation Structure Source: https://github.com/lkiesow/python-feedgen/blob/main/doc/api.rst This entry describes the overall structure of the API documentation for the python-feedgen library. It lists the main modules and extensions that contain detailed API specifications, such as classes, methods, and their parameters. ```APIDOC .. automodule:: feedgen :members: Contents: .. toctree:: :maxdepth: 2 api.feed api.entry api.util ext/api.ext.base ext/api.ext.dc ext/api.ext.podcast ext/api.ext.podcast_entry ext/api.ext.torrent ``` -------------------------------- ### Feedgen Feed Module API Documentation Source: https://github.com/lkiesow/python-feedgen/blob/main/doc/api.feed.rst This section documents the feedgen.feed module, which is the core component for generating RSS and Atom feeds. It includes all public members of the module, such as classes, methods, and attributes, providing detailed information on their usage, parameters, and return values. ```APIDOC feedgen.feed Module Documentation: This module provides the primary functionality for creating and managing RSS and Atom feeds. Key components include: - Feed class: Represents a feed document. - Entry class: Represents an individual item within a feed. - Various methods for adding content, metadata, and customizing the feed structure. Usage typically involves instantiating the Feed class and adding entries to it. Example: from feedgen.feed import Feed fg = Feed() fg.title('My Awesome Feed') fg.link('http://example.com') fg.description('A feed of my thoughts') fg.add_entry(title='First Post', link='http://example.com/post1', published='2023-01-01T10:00:00Z', content='This is the content of the first post.') print(fg.rss()) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.