PYFEEDGEN.TEX(1) python-feedgen PYFEEDGEN.TEX(1) (NAME) pyFeedGen.tex - pyFeedGen (Table of Contents) o Feedgenerator o o o o o o o o ATOM RSS . . FreeBSD LGPLv3+ . . license.bsd license.lgpl . : o o o (INSTALLATION) ( Fedora Linux) . : $ dnf install python3-feedgen pip pip feedgen . : $ pip install feedgen FeedGenerator : 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') : o (keyword arguments) o (dictionary) o : 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'}, ...]) (GENERATE THE FEED) RSS ATOM : 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 (ADD FEED ENTRIES) () FeedEntry FeedGenerator . FeedGenerator FeedEntry : fe = fg.add_entry() fe.id('http://lernfunk.de/media/654321/1') fe.title('The First Episode') fe.link(href="http://lernfunk.de/feed") add_entry(...) FeedGenerator FeedEntry . (EXTENSIONS) FeedGenerator XML . : fg.load_extension('someext', atom=True, rss=True) <> ext/someext.py . someext.py <> extend_rss(...) extend_atom(...) . BaseExtension ext/base.py (superclass) . load_extension('someext', ...) <> . SomextExtension ext/someext_entry.py . atom rss ATOM RSS . True . : (Producing a Podcast) podcast . RSS ITunes . podcast : 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') ... fg.rss_str(pretty=True) fg.rss_file('podcast.xml') FeedGenerator . load_extension(...) FeedEntry . extensions False . (Custom Extensions) feedgen register_extension . ..SH " (TESTING THE GENERATOR)" : $ python -m feedgen __main__.py . API (API DOCUMENTATION) feedgen ATOM RSS . . copyright 2013 Lars Kiesow license FreeBSD LGPL license.* . (Create a Feed) FeedGenerator : >>> 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') : o o o : >>> fg.contributor(name='John Doe', email='jdoe@example.com' ) >>> fg.contributor({'name':'John Doe', 'email':'jdoe@example.com'}) >>> fg.contributor([{'name':'John', 'email':'jdoe@example.com'}, ]) (Generate the Feed) RSS ATOM : >>> 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 () FeedEntry FeedGenerator . add_entry(...) : >>> fe = fg.add_entry() >>> fe.id('http://lernfunk.de/media/654321/1') >>> fe.title('The First Episode') add_entry(...) FeedGenerator FeedEntry . (Extensions) FeedGenerator XML . : >>> fg.load_extension('someext', atom=True, rss=True) <> ext/someext.py . someext.py <> extend_rss(...) extend_atom(...) . BaseExtension ext/base.py (superclass) . load_extension('someext', ...) <> . SomextExtension ext/someext_entry.py . atom rss FeedGenerator ATOM RSS . true . : podcast . RSS ITunes . podcast : >>> from feedgen.feed import FeedGenerator >>> fg = FeedGenerator() >>> fg.load_extension('podcast') ... >>> fg.podcast.itunes_category('Technology', 'Podcasting') ... >>> fg.rss_str(pretty=True) >>> fg.rss_file('podcast.xml') FeedEntry FeedGenerator . load_extension(...) FeedEntry . ATOM RSS . extensions False ..SS (Testing the Generator) : $ python -m feedgen : feedgen.feed copyright 2013-2020, Lars Kiesow <> license FreeBSD and LGPL, see license.* for more details. class feedgen.feed.FeedGenerator FeedGenerator ATOM RSS. add_entry(feedEntry=None, order='prepend') . feedEntry Entry . . o feedEntry -- FeedEntry . o order -- prepend . append (: prepend). FeedEntry . : ... >>> entry = feedgen.add_entry() >>> entry.title('First feed entry') add_item(item=None) . item FeedEntry . (...)add_entry . atom_file(filename, extensions=True, pretty=False, encoding='UTF-8', xml_declaration=True) ATOM XML . o filename -- URL. o extensions -- xml (: ). o pretty -- . o encoding -- XML (: UTF-8). o xml_declaration -- XML (: ). atom_str(pretty=False, extensions=True, encoding='UTF-8', xml_declaration=True) ATOM XML . o pretty -- . o extensions -- xml (: ). o encoding -- XML (: UTF-8). o xml_declaration -- XML (: ). ATOM. : Python encoding . lxml : author(author=None, replace=False, **kwargs) . URI . ATOM RSS . : o o o : o name . o uri . o email . o author -- . o replace -- . . : >>> feedgen.author({'name':'John Doe', 'email':'jdoe@example.com'}) [{'name':'John Doe','email':'jdoe@example.com'}] >>> feedgen.author([{'name':'Mr. X'},{'name':'Max'}]) [{'name':'John Doe','email':'jdoe@example.com'}, {'name':'John Doe'}, {'name':'Max'}] >>> feedgen.author(name='John Doe', email='jdoe@example.com', replace=True) [{'name':'John Doe','email':'jdoe@example.com'}] category(category=None, replace=False, **kwargs) . : o o o : o term o scheme URI . o label label RSS term . scheme domain RSS . o category -- . o replace -- . . cloud(domain=None, port=None, path=None, registerProcedure=None, protocol=None) cloud . RSS . rssCloud HTTP-POST XML-RPC SOAP 1.1 . o domain -- . o port -- (port) . o path -- . o registerProcedure -- . o protocol -- HTTP-POST XML-RPC SOAP 1.1 . cloud. contributor(contributor=None, replace=False, **kwargs) (contributor) . ATOM . : - - - : - name . - uri . - email . o contributor -- . o replace -- . . copyright(copyright=None) (copyright) . RSS atom:rights . copyright -- . . description(description=None) (description) . RSS . RSS . atom:subtitle atom:subtitle . description -- . . docs(docs=None) docs . RSS . URL RSS . [1] . RSS . [1]: docs -- URL . URL . entry(entry=None, replace=False) (entries) . add_entry() FeedEntry . FeedEntry . entry -- FeedEntry FeedEntry. . generator(generator=None, version=None, uri=None) generator . uri version ATOM . o generator -- . o version -- . o uri -- URI . icon(icon=None) . . ATOM . icon -- URI . URI . id(id=None) URI . . ATOM ATOM . id -- (Id) ATOM. (Id) . image(url=None, title=None, link=None, width=None, height=None, description=None) . atom:logo . o url -- URL GIF JPEG PNG. o title -- . . o link -- URL . alternate . o width -- . 144 . o height -- . 400 . o description -- . dictionary. item(item=None, replace=False) . entry(...) . language(language=None) . . . RSS . xml:lang ATOM . IETF . language -- . . lastBuildDate(lastBuildDate=None) lastBuildDate . datetime.datetime. (timezone) . atom:updated rss:lastBuildDate . lastBuildDate . lastBuildDate -- . datetime.datetime link(link=None, replace=False, **kwargs) (link). dict href rel type hreflang title length . href ATOM . : o o dictionary o dictionary : o href URI ( ) o rel . URI (=alternate): o alternate (entry) html . o enclosure . o related . o self . o via . o type (media type) . o hreflang . o title . o length . RSS URL . o link -- Dict dict . o replace -- (: False) : >>> feedgen.link( href='http://example.com/', rel='self') [{'href':'http://example.com/', 'rel':'self'}] load_extension(name, atom=True, rss=True) . o name -- . o atom -- ATOM . o rss -- RSS . logo(logo=None) . . ATOM rss:image . logo -- . . managingEditor(managingEditor=None) managingEditor . RSS . managingEditor -- . . pubDate(pubDate=None) . New York Times . pubDate . datetime.datetime. . atom:updated rss:lastBuildDate . pubDate -- . datetime.datetime rating(rating=None) PICS . RSS . register_extension(namespace, extension_class_feed=None, extension_class_entry=None, atom=True, rss=True) . o namespace -- o extension_class_feed -- . o extension_class_entry -- (entry) o atom -- ATOM . o rss -- RSS . remove_entry(entry) . FeedEntry . entry -- . remove_item(item) . remove_entry . rights(rights=None) (copyright) . ATOM rss:copyright . rights -- . rss_file(filename, extensions=True, pretty=False, encoding='UTF-8', xml_declaration=True) RSS XML . o filename -- . o extensions -- XML (: ). o pretty -- . o encoding -- XML (: UTF-8). o xml_declaration -- XML (: ). rss_str(pretty=False, extensions=True, encoding='UTF-8', xml_declaration=True) RSS XML . o pretty -- . o extensions -- XML (: ). o encoding -- XML (: UTF-8). o xml_declaration -- XML (: ). RSS. : Python (encoding) . lxml skipDays(days=None, replace=False) skipDays (aggregators) . RSS . . 'Monday' 'Sunday' . o hours -- . o replace -- . . skipHours(hours=None, replace=False) skipHours . RSS . . 0 23 . o hours -- . o replace -- . . subtitle(subtitle=None) subtitle . ATOM rss:description . subtitle -- . . textInput(title=None, description=None, name=None, link=None) textInput. RSS . . . . o title -- Submit . o description -- . o name -- . o link -- URL CGI script . textInput. title(title=None) (title) . . . ATOM RSS . title -- . . ttl(ttl=None) ttl. RSS . ttl time to live . () . ttl -- . (Time to live). updated(updated=None) updated . datetime.datetime . (timezone) . atom:updated rss:lastBuildDate . updated . updated -- . datetime.datetime webMaster(webMaster=None) webMaster . RSS . webMaster -- webmaster. webmaster. copyright 2013-2020, Lars Kiesow <> license FreeBSD LGPL license.* . class feedgen.entry.FeedEntry FeedEntry (entry) ATOM (item) RSS . atom_entry(extensions=True) ATOM . author(author=None, replace=False, **kwargs) (author). dict name email uri . name ATOM email RSS . : - (keyword arguments) - - : - name . - uri . - email . (Parameters) o author -- . o replace -- . : >>> author({'name':'John Doe', 'email':'jdoe@example.com'}) [{'name':'John Doe','email':'jdoe@example.com'}] >>> author([{'name': 'Mr. X'}, {'name': 'Max'}]) [{'name':'John Doe','email':'jdoe@example.com'}, {'name':'John Doe'}, {'name':'Max'}] >>> author(name='John Doe', email='jdoe@example.com', replace=True) [{'name':'John Doe','email':'jdoe@example.com'}] category(category=None, replace=False, **kwargs) . : - - - : - term . - scheme URI . - label . (label) RSS term . scheme domain RSS . (Parameters) o category -- . o replace -- . (Returns) . comments(comments=None) comments URL . RSS . (Parameters) comments -- URL . (Returns) URL . content(content=None, src=None, type=None) . ATOM . ( ) rss:description . (Parameters) o content -- . o src -- . o type -- type CDATA (escape) . (Returns) (Content) . contributor(contributor=None, replace=False, **kwargs) (contributor) . ATOM . : - - - : - name . - uri . - email . (Parameters) o contributor -- . o replace -- . (Returns) . description(description=None, isSummary=False) description . description RSS . ATOM summary content . isSummary description ATOM . (Parameters) o description -- . o isSummary -- content summary. . enclosure(url=None, length=None, type=None) enclosure . RSS ATOM link(rel=enclosure) . ATOM enclosure RSS . enclosure . RSS . o url -- (URL) . o length -- . o type -- (Mimetype) . enclosure. guid(guid=None, permalink=False) guid . atom:id . o guid -- (Id) . o permalink -- . permalink . id(id=None) (id) URI . id . rss:guid permalink False . Id ATOM . id -- (Id) . (Id) . link(link=None, replace=False, **kwargs) (link). dict href rel type hreflang title length . Href ATOM . : - - - : o href (URI) ( ). o rel . URI (=alternate): o alternate permalink html . o enclosure . o related . o self . o via . o type (media type) . o hreflang . o title . o length . RSS URL . RSS rel=alternate . RSS enclosure ATOM link . enclosure RSS rel=enclosure . o link -- . o replace -- . . load_extension(name, atom=True, rss=True) . o name -- . o atom -- ATOM . o rss -- RSS . pubDate(pubDate=None) pubDate . published(...) . pubdate(pubDate=None) pubDate . published(...) . pubdate() feedgen >= 0.8 . pubDate() . published(published=None) published . datetime.datetime . (timezone) . published -- . datetime.datetime register_extension(namespace, extension_class_entry=None, atom=True, rss=True) namespace. o namespace -- (namespace) o extension_class_entry -- . o atom -- ATOM . o rss -- RSS . rights(rights=None) (rights) (copyrights) . ATOM rss:copyright . rights -- . . rss_entry(extensions=True) RSS . source(url=None, title=None) (source) . ATOM title URL ( RSS ) . (patches) . o url -- . o title -- . summary(summary=None, type=None) (summary) . summary ATOM ( src ) base64 . rss:description summary . summary -- . . title(title=None) (title) . . ATOM RSS . title -- . . ttl(ttl=None) ttl. RSS . ttl time to live () . ttl -- time to live . time to live . updated(updated=None) updated . datetime.datetime. (timezone) . updated -- . datetime.datetime (feed generator) . 2013, Lars Kiesow <> FreeBSD LGPL license.* . feedgen.util.ensure_format(val, allowed, required, allowed_values=None, defaults=None) . o val -- . o allowed -- . o required -- . o allowed_values -- . o defaults -- . . feedgen.util.formatRFC2822(date) (locale) . feedgen.ext.base FeedGenerator . 2013, Lars Kiesow <> FreeBSD LGPL license.* . class feedgen.ext.base.BaseEntryExtension FeedEntry. class feedgen.ext.base.BaseExtension FeedGenerator. extend_atom(feed) xml ATOM . feed -- xml . . extend_ns() dict (namespace map) . extend_rss(feed) xml RSS . feed -- xml . . FeedGenerator Dublin Core . 2013-2017, Lars Kiesow <> FreeBSD LGPL *license . class feedgen.ext.dc.DcBaseExtension Dublin Core . dc_contributor(contributor=None, replace=False) dc:contributor . : o contributor -- . o replace -- (: False). . dc_coverage(coverage=None, replace=True) dc:coverage . . . . Thesaurus of Geographic Names [TGN] . . : [TGN] o coverage -- (coverage) . o replace -- (: True). . dc_creator(creator=None, replace=False) dc:creator . : o creator -- . o replace -- (: False). . dc_date(date=None, replace=True) dc:date . : o date -- . o replace -- (: True). . dc_description(description=None, replace=True) dc:description . : o description -- . o replace -- (: True). . dc_format(format=None, replace=True) dc:format . : o format -- . o replace -- (: True). . dc_identifier(identifier=None, replace=True) dc:identifier . : o identifier -- . o replace -- (: True). . dc_language(language=None, replace=True) dc:language . : o language -- . o replace -- (: True). . dc_publisher(publisher=None, replace=False) dc:publisher . : o publisher -- . o replace -- (: False). . dc_relation(relation=None, replace=False) dc:relation . : o relation -- . o replace -- (: False). . dc_rights(rights=None, replace=False) dc:rights . : o rights -- . o replace -- (: False). . dc_source(source=None, replace=False) dc:source . . . : o source -- . o replace -- (: False). . dc_subject(subject=None, replace=False) dc:subject . : o subject -- . o replace -- (: False). . dc_title(title=None, replace=True) dc:title . : o title -- . o replace -- (: False). . dc_type(type=None, replace=False) dc:type . : o type -- . o replace -- (: False). . extend_atom(atom_feed) Atom DC . atom_feed -- extend_ns() dict . extend_rss(rss_feed) RSS DC. rss_feed -- . class feedgen.ext.dc.DcEntryExtension Dublin Core . extend_atom(entry) dc atom. . entry -- entry atom. entry. extend_rss(item) dc RSS. . item -- RSS. . class feedgen.ext.dc.DcExtension Dublin Core . feedgen.ext.podcast FeedGenerator . 2013, Lars Kiesow <> FreeBSD LGPL license.* . class feedgen.ext.podcast.PodcastExtension FeedGenerator . extend_ns() dict . extend_rss(rss_feed) RSS itunes. . itunes_author(itunes_author=None) itunes:author. Artist iTunes . iTunes . iTunes . itunes_author -- . . itunes_block(itunes_block=None) block iTunes. iTunes . itunes_block -- . . itunes_category(itunes_category=None, replace=False, **kwargs) iTunes category iTunes Store . (-) . : o itunes_category o itunes_category o itunes_category itunes_category : o cat . o sub . : [{"cat":"Arts","sub":"Design"},{"cat":"Arts","sub":"Food"}] o itunes_category -- itunes_category..IP o 2 replace -- . itunes_categories . --- : feedgen . . itunes_complete(itunes_complete=None) itunes:complete . . "yes" . ( "no") . itunes_complete -- . . itunes_explicit(itunes_explicit=None) itunes:explicit . () . "yes" "no" "clean". "yes" "explicit" iTunes Store Name iTunes . "clean" Clean "clean" . explicit ( "no") -- . itunes_explicit -- . . itunes_image(itunes_image=None) . (artwork) . (URL) href . iTunes .jpg 1400x1400 RSS . iTunes Store 1400x1400 . iTunes JPEG PNG RGB (CMYK ). ".jpg" ".png" . iTunes RSS . . iTunes URL . HTTP HEAD iTS . itunes_image -- . . itunes_new_feed_url(itunes_new_feed_url=None) new-feed-url . (URL) . . iTunes URL . itunes_new_feed_url -- (URL) . (URL) . itunes_owner(name=None, email=None) itunes:owner . . . itunes_owner -- . . itunes_subtitle(itunes_subtitle=None) itunes:subtitle . Description iTunes . . itunes_subtitle -- . . itunes_summary(itunes_summary=None) itunes:summary . "i " Description . iTunes . . . itunes_summary -- . . itunes_type(itunes_type=None) itunes:type . . "episodic" "serial". (Serial) . episodic . Apple Podcasts () . - . serial . Apple Podcasts () . . itunes_type -- .TP . feedgen.ext.podcast_entry feedgen . 2013-2016, Lars Kiesow <> FreeBSD LGPL license.* . class feedgen.ext.podcast_entry.PodcastEntryExtension FeedEntry . extend_rss(entry) RSS. feed -- XML RSS . itunes_author(itunes_author=None) itunes:author . Artist iTunes . iTunes . iTunes . itunes_author -- . . itunes_block(itunes_block=None) iTunes. iTunes . itunes_block -- . . itunes_duration(itunes_duration=None) . Time iTunes . HH:MM:SS H:MM:SS MM:SS M:SS (H = M = S = ). ( ) . . . itunes_duration -- . . itunes_episode(itunes_episode=None) itunes:episode . itunes_season -- . . itunes_episode_type(itunes_episode_type=None) itunes:episodeType . . "full" "trailer" "bonus". . full . trailer . ( ) bonus . itunes_episode_type -- . itunes_explicit(itunes_explicit=None) itunes:explicit . () . "yes" "no" "clean". "yes" "explicit" iTunes Store Name iTunes . "clean" Clean "clean" . explicit ( "no") -- (blank) . itunes_explicit -- . . itunes_image(itunes_image=None) . () . URL href . iTunes jpg. 1400x1400 RSS . iTunes Store 1400x1400 . iTunes JPEG PNG RGB (CMYK ). URL ".jpg" ".png" . iTunes RSS . . iTunes URL . HTTP head iTS . itunes_image -- . . itunes_is_closed_captioned(itunes_is_closed_captioned=None) is_closed_captioned . (closed captioning) . "yes" "no". is_closed_captioned -- (closed captioning) . . itunes_order(itunes_order=None) itunes:order . . . <<1>> . (pubDate) . order . itunes_order -- . . itunes_season(itunes_season=None) itunes:season . itunes_season -- . . itunes_subtitle(itunes_subtitle=None) itunes:subtitle . Description iTunes . . itunes_subtitle -- . . itunes_summary(itunes_summary=None) itunes:summary . "i " Description . iTunes . 4000 . . itunes_summary -- . . itunes_title(itunes_title=None) itunes:title . Apple Podcasts. . . itunes_title -- Apple Podcasts Apple Podcast FeedGenerator . 2016, Raspbeguy <> FreeBSD LGPL license.* . class feedgen.ext.torrent.TorrentEntryExtension FeedEntry contentlength(torrent_contentlength=None) . torrent_contentlength -- . . extend_rss(entry) RSS. feed -- XML RSS . filename(torrent_filename=None) . torrent_filename -- . . infohash(torrent_infohash=None) . torrent_infohash -- . . peers(torrent_peers=None) (peers). torrent_infohash -- . . seeds(torrent_seeds=None) (seeds). torrent_seeds -- . . verified(torrent_verified=None) . torrent_infohash -- . . class feedgen.ext.torrent.TorrentExtension FeedGenerator . extend_ns() dict (namespace map) . o <> o <> o <> Lars Kiesow (COPYRIGHT) 2013-2016, Lars Kiesow 1.0 December 14, 2025 PYFEEDGEN.TEX(1)