{"id":13502267,"url":"https://github.com/lkiesow/python-feedgen","last_synced_at":"2025-05-14T18:06:58.996Z","repository":{"id":8297040,"uuid":"9838560","full_name":"lkiesow/python-feedgen","owner":"lkiesow","description":"Python module to generate ATOM feeds, RSS feeds and Podcasts.","archived":false,"fork":false,"pushed_at":"2024-07-04T10:19:12.000Z","size":1337,"stargazers_count":764,"open_issues_count":11,"forks_count":126,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-12T11:06:51.164Z","etag":null,"topics":["atom","feed","python","rss"],"latest_commit_sha":null,"homepage":"https://feedgen.kiesow.be/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lkiesow.png","metadata":{"files":{"readme":"readme.rst","changelog":null,"contributing":null,"funding":null,"license":"license.bsd","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.rst","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-05-03T15:14:54.000Z","updated_at":"2025-05-12T09:54:41.000Z","dependencies_parsed_at":"2023-12-21T20:45:11.986Z","dependency_job_id":"69f2fb3f-9030-442f-8d4e-52bd41d886a6","html_url":"https://github.com/lkiesow/python-feedgen","commit_stats":{"total_commits":260,"total_committers":41,"mean_commits":6.341463414634147,"dds":"0.30000000000000004","last_synced_commit":"97260abb1793eb164c458c10b493690beb413f6d"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkiesow%2Fpython-feedgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkiesow%2Fpython-feedgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkiesow%2Fpython-feedgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkiesow%2Fpython-feedgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkiesow","download_url":"https://codeload.github.com/lkiesow/python-feedgen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198515,"owners_count":22030966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atom","feed","python","rss"],"created_at":"2024-07-31T22:02:08.090Z","updated_at":"2025-05-14T18:06:53.985Z","avatar_url":"https://github.com/lkiesow.png","language":"Python","readme":"=============\nFeedgenerator\n=============\n\nThis module can be used to generate web feeds in both ATOM and RSS format. It\nhas support for extensions. Included is for example an extension to produce\nPodcasts.\n\nIt is licensed under the terms of both, the FreeBSD license and the LGPLv3+.\nChoose the one which is more convenient for you. For more details have a look\nat license.bsd and license.lgpl.\n\nMore details about the project:\n\n- `Repository \u003chttps://github.com/lkiesow/python-feedgen\u003e`_\n- `Documentation \u003chttps://lkiesow.github.io/python-feedgen/\u003e`_\n- `Python Package Index \u003chttps://pypi.python.org/pypi/feedgen/\u003e`_\n\n\n------------\nInstallation\n------------\n\n**Prebuild packages**\n\nIf your distribution includes this project as package, like Fedora Linux does,\nyou can simply use your package manager to install the package. For example::\n\n    $ dnf install python3-feedgen\n\n\n**Using pip**\n\nYou can also use pip to install the feedgen module. Simply run::\n\n    $ pip install feedgen\n\n\n-------------\nCreate a Feed\n-------------\n\nTo create a feed simply instantiate the FeedGenerator class and insert some\ndata:\n\n.. code-block:: python\n\n    from feedgen.feed import FeedGenerator\n    fg = FeedGenerator()\n    fg.id('http://lernfunk.de/media/654321')\n    fg.title('Some Testfeed')\n    fg.author( {'name':'John Doe','email':'john@example.de'} )\n    fg.link( href='http://example.com', rel='alternate' )\n    fg.logo('http://ex.com/logo.jpg')\n    fg.subtitle('This is a cool feed!')\n    fg.link( href='http://larskiesow.de/test.atom', rel='self' )\n    fg.language('en')\n\nNote that for the methods which set fields that can occur more than once in a\nfeed you can use all of the following ways to provide data:\n\n- Provide the data for that element as keyword arguments\n- Provide the data for that element as dictionary\n- Provide a list of dictionaries with the data for several elements\n\nExample:\n\n.. code-block:: python\n\n    fg.contributor( name='John Doe', email='jdoe@example.com' )\n    fg.contributor({'name':'John Doe', 'email':'jdoe@example.com'})\n    fg.contributor([{'name':'John Doe', 'email':'jdoe@example.com'}, ...])\n\n-----------------\nGenerate the Feed\n-----------------\n\nAfter that you can generate both RSS or ATOM by calling the respective method:\n\n.. code-block:: python\n\n    atomfeed = fg.atom_str(pretty=True) # Get the ATOM feed as string\n    rssfeed  = fg.rss_str(pretty=True) # Get the RSS feed as string\n    fg.atom_file('atom.xml') # Write the ATOM feed to a file\n    fg.rss_file('rss.xml') # Write the RSS feed to a file\n\n\n----------------\nAdd Feed Entries\n----------------\n\nTo add entries (items) to a feed you need to create new FeedEntry objects and\nappend them to the list of entries in the FeedGenerator. The most convenient\nway to go is to use the FeedGenerator itself for the instantiation of the\nFeedEntry object:\n\n.. code-block:: python\n\n    fe = fg.add_entry()\n    fe.id('http://lernfunk.de/media/654321/1')\n    fe.title('The First Episode')\n    fe.link(href=\"http://lernfunk.de/feed\")\n\nThe FeedGenerator's method `add_entry(...)` will generate a new FeedEntry\nobject, automatically append it to the feeds internal list of entries and\nreturn it, so that additional data can be added.\n\n----------\nExtensions\n----------\n\nThe FeedGenerator supports extensions to include additional data into the XML\nstructure of the feeds. Extensions can be loaded like this:\n\n.. code-block:: python\n\n    fg.load_extension('someext', atom=True, rss=True)\n\nThis example would try to load the extension “someext” from the file\n`ext/someext.py`.  It is required that `someext.py` contains a class named\n“SomextExtension” which is required to have at least the two methods\n`extend_rss(...)` and `extend_atom(...)`. Although not required, it is strongly\nsuggested to use `BaseExtension` from `ext/base.py` as superclass.\n\n`load_extension('someext', ...)` will also try to load a class named\n“SomextEntryExtension” for every entry of the feed. This class can be located\neither in the same file as SomextExtension or in `ext/someext_entry.py` which\nis suggested especially for large extensions.\n\nThe parameters `atom` and `rss` control if the extension is used for ATOM and\nRSS feeds respectively. The default value for both parameters is `True`,\nmeaning the extension is used for both kinds of feeds.\n\n**Example: Producing a Podcast**\n\nOne extension already provided is the podcast extension. A podcast is an RSS\nfeed with some additional elements for ITunes.\n\nTo produce a podcast simply load the `podcast` extension:\n\n.. code-block:: python\n\n    from feedgen.feed import FeedGenerator\n    fg = FeedGenerator()\n    fg.load_extension('podcast')\n    ...\n    fg.podcast.itunes_category('Technology', 'Podcasting')\n    ...\n    fe = fg.add_entry()\n    fe.id('http://lernfunk.de/media/654321/1/file.mp3')\n    fe.title('The First Episode')\n    fe.description('Enjoy our first episode.')\n    fe.enclosure('http://lernfunk.de/media/654321/1/file.mp3', 0, 'audio/mpeg')\n    ...\n    fg.rss_str(pretty=True)\n    fg.rss_file('podcast.xml')\n\nIf the FeedGenerator class is used to load an extension, it is automatically\nloaded for every feed entry as well.  You can, however, load an extension for a\nspecific FeedEntry only by calling `load_extension(...)` on that entry.\n\nEven if extensions are loaded, they can be temporarily disabled during the feed\ngeneration by calling the generating method with the keyword argument\n`extensions` set to `False`.\n\n**Custom Extensions**\n\nIf you want to load custom extensions which are not part of the feedgen\npackage, you can use the method `register_extension` instead. You can directly\npass the classes for the feed and the entry extension to this method meaning\nthat you can define them everywhere.\n\n\n---------------------\nTesting the Generator\n---------------------\n\nYou can test the module by simply executing::\n\n    $ python -m feedgen\n\nIf you want to have a look at the code for this test to have a working code\nexample for a whole feed generation process, you can find it in the\n`__main__.py \u003chttps://github.com/lkiesow/python-feedgen/blob/master/feedgen/__main__.py\u003e`_.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkiesow%2Fpython-feedgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkiesow%2Fpython-feedgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkiesow%2Fpython-feedgen/lists"}