PYFEEDGEN.TEX(1)
β¨ pyFeedGen.tex β pyFeedGen Documentation β¨
okay bestie, buckle up π
this is the python-feedgen page, and it's literally the glow-up manual for generating web feeds. no cap, it's a whole vibe.
π NAME π
pyFeedGen.tex β pyFeedGen Documentation. that's the whole name. iconic, brief, slay.
πΈ Table of Contents πΈ
- Feedgenerator
- Installation
- Create a Feed
- Generate the Feed
- Add Feed Entries
- Extensions
- Testing the Generator
- Module documentation
- Indices and tables
so basically this module generates web feeds in both ATOM and RSS format. it has extension support too β like, included is literally an extension for producing Podcasts ποΈβ¨
its licensing is giving "choose your own adventure": it's licensed under the terms of both the FreeBSD license and the LGPLv3+. pick whichever one is more convenient for you, bestie π«Ά for more details have a look at license.bsd and license.lgpl.
more details about the project:
- Repository β
https://github.com/lkiesow/python-feedgen - Documentation β
https://lkiesow.github.io/python-feedgen/ - Python Package Index β
https://pypi.python.org/pypi/feedgen/
π INSTALLATION π
Prebuild packages
if your distribution includes this project as a package (like Fedora Linux literally does), you can simply use your package manager to install it. easy. for example:
$ dnf install python3-feedgen
Using pip
you can also use pip to install the feedgen module. simply run:
$ pip install feedgen
and that's it π
π¦ CREATE A FEED π¦
to create a feed, simply instantiate the FeedGenerator class and insert some data:
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')
okay but here's the part you actually need to remember π for the methods that set fields which can occur more than once in a feed, you can use all of the following ways to provide data:
- provide the data for that element as keyword arguments
- provide the data for that element as a dictionary
- provide a list of dictionaries with the data for several elements
example:
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'}, ...])
three ways, one slay π
β GENERATE THE FEED β
after that, you can generate both RSS or ATOM by calling the respective method:
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
strings or files, your choice, we support both, we're not gatekeeping π
π ADD FEED ENTRIES π
to add entries (items) to a feed, you need to create new FeedEntry objects and append them to the list of entries in the FeedGenerator. the most convenient way to go is to use the FeedGenerator itself for the instantiation of the FeedEntry object:
fe = fg.add_entry()
fe.id('http://lernfunk.de/media/654321/1')
fe.title('The First Episode')
fe.link(href="http://lernfunk.de/feed")
the FeedGenerator's method add_entry(...) will generate a new FeedEntry object, automatically append it to the feed's internal list of entries, and return it, so that additional data can be added. it literally does everything for you, main character energy fr fr π
π EXTENSIONS π
the FeedGenerator supports extensions to include additional data into the XML structure of the feeds. extensions can be loaded like this:
fg.load_extension('someext', atom=True, rss=True)
this example would try to load the extension βsomeextβ from the file ext/someext.py. it is required that someext.py contains a class named βSomextExtensionβ which is required to have at least the two methods extend_rss(...) and extend_atom(...). although not required, it is strongly suggested to use BaseExtension from ext/base.py as superclass π«Ά
load_extension('someext', ...) will also try to load a class named βSomextEntryExtensionβ for every entry of the feed. this class can be located either in the same file as SomextExtension or in ext/someext_entry.py β which is suggested especially for large extensions.
the parameters atom and rss control if the extension is used for ATOM and RSS feeds respectively. the default value for both parameters is True, meaning the extension is used for both kinds of feeds. periodt.
π§ Example: Producing a Podcast π§
one extension already provided is the podcast extension. a podcast is an RSS feed with some additional elements for ITunes. yes bestie, that's literally all a podcast is on the inside ποΈ
to produce a podcast, simply load the podcast extension:
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')
if the FeedGenerator class is used to load an extension, it is automatically loaded for every feed entry as well π₯ you can, however, load an extension for a specific FeedEntry only by calling load_extension(...) on that entry.
even if extensions are loaded, they can be temporarily disabled during the feed generation by calling the generating method with the keyword argument extensions set to False. so you can absolutely have your extensions and also not have them. flexible queen behavior π
πΈ Custom Extensions πΈ
if you want to load custom extensions which are not part of the feedgen package, you can use the method register_extension instead. you can directly pass the classes for the feed and the entry extension to this method, meaning that you can define them everywhere. everywhere!! π¦
π§ TESTING THE GENERATOR π§
you can test the module by simply executing:
$ python -m feedgen
if you want to have a look at the code for this test to have a working code example for a whole feed generation process, you can find it in the __main__.py at https://github.com/lkiesow/python-feedgen/blob/master/feedgen/__main__.py π
π API DOCUMENTATION π
π feedgen π
this module can be used to generate web feeds in both ATOM and RSS format. it has support for extensions. included is for example an extension to produce Podcasts.
- copyright β 2013 by Lars Kiesow
- license β FreeBSD and LGPL, see
license.*for more details.
β¨ Create a Feed β¨
to create a feed, simply instantiate the FeedGenerator class and insert some data:
>>> 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')
note that for the methods which set fields that can occur more than once in a feed, you can use all of the following ways to provide data:
- provide the data for that element as keyword arguments
- provide the data for that element as dictionary
- provide a list of dictionaries with the data for several elements
example:
>>> 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 π
after that, you can generate both RSS or ATOM by calling the respective method:
>>> 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 π¦
to add entries (items) to a feed, you need to create new FeedEntry objects and append them to the list of entries in the FeedGenerator. the most convenient way to do this is to call the method add_entry(...) like this:
>>> fe = fg.add_entry()
>>> fe.id('http://lernfunk.de/media/654321/1')
>>> fe.title('The First Episode')
the FeedGenerator's method add_entry(...) will automatically create a new FeedEntry object, append it to the feed's internal list of entries, and return it, so that additional data can be added. no cap, it's that easy π
π Extensions π
the FeedGenerator supports extension to include additional data into the XML structure of the feeds. extensions can be loaded like this:
>>> fg.load_extension('someext', atom=True, rss=True)
this will try to load the extension βsomeextβ from the file ext/someext.py. it is required that someext.py contains a class named βSomextExtensionβ which is required to have at least the two methods extend_rss(...) and extend_atom(...). although not required, it is strongly suggested to use BaseExtension from ext/base.py as superclass π
load_extension('someext', ...) will also try to load a class named βSomextEntryExtensionβ for every entry of the feed. this class can be located either in the same file as SomextExtension or in ext/someext_entry.py, which is suggested especially for large extensions.
the parameters atom and rss tell the FeedGenerator if the extensions should only be used for either ATOM or RSS feeds. the default value for both parameters is true, which means that the extension would be used for both kinds of feeds.
ποΈ Example: Producing a Podcast ποΈ
one extension already provided is the podcast extension. a podcast is an RSS feed with some additional elements for ITunes.
to produce a podcast, simply load the podcast extension:
>>> 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')
of course the extension has to be loaded for the FeedEntry objects as well, but this is done automatically by the FeedGenerator for every feed entry if the extension is loaded for the whole feed. you can, however, load an extension for a specific FeedEntry by calling load_extension(...) on that entry. but this is a rather uncommon use. lowkey niche, but valid π«Ά
of course you can still produce a normal ATOM or RSS feed, even if you have loaded some plugins, by temporarily disabling them during the feed generation. this can be done by calling the generating method with the keyword argument extensions set to False. so chill, your plugins aren't holding your feed hostage π
β Testing the Generator β
you can test the module by simply executing:
$ python -m feedgen
Contents:
πΈ feedgen.feed
π copyright
2013-2020, Lars Kiesow <<lkiesow@uos.de>>
π license
FreeBSD and LGPL, see license.* for more details. iykyk, go read the files bestie π«Ά
π class feedgen.feed.FeedGenerator
okay so this is THE main character right here β the FeedGenerator that generates your ATOM and RSS feeds β¨ It's literally the whole point of the library.
β add_entry(feedEntry=None, order='prepend')
This one adds a shiny new entry to your feed π And here's the cute part: if you don't pass the feedEntry argument, it just makes a brand new Entry object for you automatically β no cap, that's the preferred way to add new entries to a feed. π
Parameters
feedEntryβ theFeedEntryobject you wanna add.orderβ ifprependis chosen, the entry gets inserted at the beginning of the feed. Ifappendis chosen, it gets appended to the feed. (default:prepend).
Returns The FeedEntry object that was created or passed to this function.
Example:
...
>>> entry = feedgen.add_entry()
>>> entry.title('First feed entry')
heads up bestie: theorderdefault isprependβ so your new entry goes to the TOP unless you say otherwise π
β add_item(item=None)
Same energy, different name π¦ This adds a new item to the feed, and if you skip the item argument it auto-creates a fresh FeedEntry object for you. It's literally just another name for add_entry(...) β lowkey iconic of them to give us options.
β atom_file(filename, extensions=True, pretty=False, encoding='UTF-8', xml_declaration=True)
Generates an ATOM feed and writes the resulting XML straight into a file π
Parameters
filenameβ name of the file to write, or a file-like object, or a URL. yes bestie, three whole vibes.extensionsβ enable or disable the loaded extensions for the xml generation (default: enabled).prettyβ if the feed should be split into multiple lines and properly indented.encodingβ the encoding used in the XML file (default:UTF-8).xml_declarationβ if an XML declaration should be added to the output (Default: enabled).
β atom_str(pretty=False, extensions=True, encoding='UTF-8', xml_declaration=True)
Same thing but instead of writing to a file it hands you the feed XML as a string π
Parameters
prettyβ if the feed should be split into multiple lines and properly indented.extensionsβ enable or disable the loaded extensions for the xml generation (default: enabled).encodingβ the encoding used in the XML file (default:UTF-8).xml_declarationβ if an XML declaration should be added to the output (Default: enabled).
Returns A string representation of the ATOM feed.
Return type: ngl the return type may vary between different Python versions and the encoding parameters you pass to this method π For the details, go look at the lxml documentation: <https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.tostring>
β author(author=None, replace=False, **kwargs)
Get or set the author data π«Ά An author element is a dictionary holding a name, an email address and a uri. Name is mandatory for ATOM, email is mandatory for RSS. Important detail, don't skip it bestie π
This method can be called with:
- the fields of an author as keyword arguments
- the fields of an author as a dictionary
- a list of dictionaries containing the author fields
An author has the following fields:
nameβ conveys a human-readable name for the person.uriβ contains a home page for the person.emailβ contains an email address for the person.
Parameters
authorβ Dictionary or list of dictionaries with author data.replaceβ Add or replace old data.
Returns A list of authors as dictionaries.
Example:
>>> 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)
Get or set the categories your feed belongs to π·οΈ lil organizational moment.
This method can be called with:
- the fields of a category as keyword arguments
- the fields of a category as a dictionary
- a list of dictionaries containing the category fields
A categories has the following fields:
termβ identifies the categoryschemeβ identifies the categorization scheme via a URI.labelβ provides a human-readable label for display
If a label is present it is used for the RSS feeds. Otherwise the term is used. The scheme is used for the domain attribute in RSS. β¨ (yes, we're keeping all those details, that's the whole vibe)
Parameters
categoryβ Dict or list of dicts with data.replaceβ Add or replace old data.
Returns A list of category data.
β cloud(domain=None, port=None, path=None, registerProcedure=None, protocol=None)
Set or get the cloud data of the feed βοΈ It's an RSS only attribute. It specifies a web service that supports the rssCloud interface which can be implemented in HTTP-POST, XML-RPC or SOAP 1.1.
Parameters
domainβ The domain where the webservice can be found.portβ The port the webservice listens to.pathβ The path of the webservice.registerProcedureβ The procedure to call.protocolβ Can be eitherHTTP-POST,XML-RPCorSOAP 1.1.
Returns A dictionary containing the cloud data. π«Ά
β contributor(contributor=None, replace=False, **kwargs)
Get or set the contributor data of the feed π This is an ATOM only value.
This method can be called with: - the fields of a contributor as keyword arguments - the fields of an contributor as a dictionary - a list of dictionaries containing the contributor fields
An contributor has the following fields: - name conveys a human-readable name for the person. - uri contains a home page for the person. - email contains an email address for the person.
Parameters
contributorβ Dictionary or list of dictionaries with contributor data.replaceβ Add or replace old data.
Returns A list of contributors as dictionaries.
β copyright(copyright=None)
Get or set the copyright notice for content in the channel π And plot twist β this RSS value will also set the atom:rights value. two birds, one adorable stone π
Parameters copyright β The copyright notice.
Returns The copyright notice.
β description(description=None)
Set and get the description of the feed π This is an RSS only element β a phrase or sentence describing the channel. It is mandatory for RSS feeds. It's roughly the same as atom:subtitle, so setting this will also set atom:subtitle. multitasking queen π
Parameters description β Description of the channel.
Returns Description of the channel.
β docs(docs=None)
Get or set the docs value of the feed π This is an RSS only value. It's a URL that points to the documentation for the format used in the RSS file. It is probably a pointer to [1]. It's for people who might stumble across an RSS file on a Web server 25 years from now and wonder what it is π honestly a public service.
[1]: <http://www.rssboard.org/rss-specification>
Parameters docs β URL of the format documentation.
Returns URL of the format documentation.
β entry(entry=None, replace=False)
Get or set feed entries β¨ But bestie, use the add_entry() method instead to automatically create the FeedEntry objects β it's the whole preferred workflow π
This method takes both a single FeedEntry object or a list of objects.
Parameters entry β FeedEntry object or list of FeedEntry objects.
Returns List of all feed entries.
β generator(generator=None, version=None, uri=None)
Get or set the generator of the feed β it identifies the software used to generate the feed, for debugging and other purposes π§ Both the uri and version attributes are optional and only available in the ATOM feed.
Parameters
generatorβ Software used to create the feed.versionβ Version of the software.uriβ URI the software can be found.
β icon(icon=None)
Get or set the icon of the feed π It's a small image that provides iconic visual identification for the feed. Icons should be square. And heads up β this is an ATOM only value.
Parameters
iconβ the URI of the feed's icon. π
Returns
The URI of the feed's icon. β¨
π id(id=None)
Okay so this one gets or sets the feed id, aka the thing that identifies the feed using a universally unique and permanent URI. If you have a long-term, renewable lease on your Internet domain name, then you can feel free to use your website's address. This field is for ATOM only. It is mandatory for ATOM. π
Parameters
idβ New Id of the ATOM feed.
Returns
Id of the feed. π¦
πΌοΈ image(url=None, title=None, link=None, width=None, height=None, description=None)
Set the image of the feed. This element is roughly equivalent to atom:logo. π
Parameters
urlβ The URL of a GIF, JPEG or PNG image.titleβ Describes the image. The default value is the feed's title.linkβ URL of the site the image will link to. The default is to use the feed's first alternate link.widthβ Width of the image in pixel. The maximum is144.heightβ The height of the image. The maximum is400.descriptionβ Title of the link.
Returns
Data of the image as dictionary. π
π§Ί item(item=None, replace=False)
Get or set feed items. This is just another name for entry(...). That's it, that's the vibe. β¨
π language(language=None)
Get or set the language of the feed. It indicates the language the channel is written in. This allows aggregators to group all Italian language sites, for example, on a single page. This is an RSS only field. However, this value will also be used to set the xml:lang property of the ATOM feed node. The value should be an IETF language tag. π¦
Parameters
languageβ Language of the feed.
Returns
Language of the feed. π
π°οΈ lastBuildDate(lastBuildDate=None)
Set or get the lastBuildDate value, which indicates the last time the content of the channel changed. Lowkey important.
The value can either be a string which will automatically be parsed or a datetime.datetime object. In any case it is necessary that the value include timezone information. Do not forget the timezone bestie, I'm begging. π
This will set both atom:updated and rss:lastBuildDate.
Default value
If not set, lastBuildDate has as value the current date and time. β°
Parameters
lastBuildDateβ The modification date.
Returns
Modification date as datetime.datetime. β¨
π link(link=None, replace=False, **kwargs)
Get or set link data. A link element is a dict with the fields href, rel, type, hreflang, title, and length. href is mandatory for ATOM. π
This method can be called with:
- the fields of a link as keyword arguments
- the fields of a link as a dictionary
- a list of dictionaries containing the link fields
A link has the following fields:
hrefis the URI of the referenced resource (typically a Web page)relcontains a single link relationship type. It can be a full URI, or one of the following predefined values (default=alternate):alternatean alternate representation of the entry or feed, for example a permalink to the html version of the entry, or the front page of the weblog.enclosurea related resource which is potentially large in size and might require special handling, for example an audio or video recording.relateda document related to the entry or feed.selfthe feed itself.viathe source of the information provided in the entry.
typeindicates the media type of the resource.hreflangindicates the language of the referenced resource.titlehuman readable information about the link, typically for display purposes.lengththe length of the resource, in bytes.
RSS only supports one link with URL only. That's the rule. π«Ά
Parameters
linkβ Dict or list of dicts with data.replaceβ If old links are to be replaced (default:False)
Returns
Current set of link data. πΈ
Example:
>>> feedgen.link( href='http://example.com/', rel='self')
[{'href':'http://example.com/', 'rel':'self'}]
π§© load_extension(name, atom=True, rss=True)
Load a specific extension by name. Plug it in, plug it in. π
Parameters
nameβ Name of the extension to load.atomβ If the extension should be used for ATOM feeds.rssβ If the extension should be used for RSS feeds.
π¨ logo(logo=None)
Get or set the logo of the feed, which is a larger image which provides visual identification for the feed. Images should be twice as wide as they are tall. This is an ATOM value but will also set the rss:image value. Main character image energy. π
Parameters
logoβ Logo of the feed.
Returns
Logo of the feed. π
π§ managingEditor(managingEditor=None)
Set or get the value for managingEditor, which is the email address for person responsible for editorial content. This is a RSS only value. π¬
Parameters
managingEditorβ Email address of the managing editor.
Returns
Email address of the managing editor. π
π
pubDate(pubDate=None)
Set or get the publication date for the content in the channel. For example, the New York Times publishes on a daily basis, the publication date flips once every 24 hours. That's when the pubDate of the channel changes. ποΈ
The value can either be a string which will automatically be parsed or a datetime.datetime object. In any case it is necessary that the value include timezone information. Again. Timezone. Do not skip it. π€
This will set both atom:updated and rss:lastBuildDate.
Parameters
pubDateβ The publication date.
Returns
Publication date as datetime.datetime. β¨
β rating(rating=None)
Set and get the PICS rating for the channel. It is an RSS only value. β
π οΈ register_extension(namespace, extension_class_feed=None, extension_class_entry=None, atom=True, rss=True)
Registers an extension by class. Very official. Very slay. π
Parameters
namespaceβ namespace for the extensionextension_class_feedβ Class of the feed extension to load.extension_class_entryβ Class of the entry extension to loadatomβ If the extension should be used for ATOM feeds.rssβ If the extension should be used for RSS feeds.
ποΈ remove_entry(entry)
Remove a single entry from the feed. This method accepts both the FeedEntry object to remove or the index of the entry as argument. Bye bestie. π
Parameters
entryβ Entry or index of entry to remove.
π§Ή remove_item(item)
Remove a single item from the feed. This is another name for remove_entry. Same energy, different name. β¨
βοΈ rights(rights=None)
Get or set the rights value of the feed which conveys information about rights, e.g. copyrights, held in and over the feed. This ATOM value will also set rss:copyright. Legal-ish queen behavior. π
Parameters
rightsβ Rights information of the feed.
π° rss_file(filename, extensions=True, pretty=False, encoding='UTF-8', xml_declaration=True)
Generates an RSS feed and writes the resulting XML to a file. ποΈ
Parameters
filenameβ Name of file to write or a file-like object or a URL.extensionsβ Enable or disable the loaded extensions for the xml generation (default: enabled).prettyβ If the feed should be split into multiple lines and properly indented.encodingβ Encoding used in the XML file (default:UTF-8).xml_declarationβ If an XML declaration should be added to the output (Default: enabled).
π rss_str(pretty=False, extensions=True, encoding='UTF-8', xml_declaration=True)
Generates an RSS feed and returns the feed XML as string. String time. π§΅
Parameters
prettyβ If the feed should be split into multiple lines and properly indented.extensionsβ Enable or disable the loaded extensions for the xml generation (default: enabled).encodingβ Encoding used in the XML file (default:UTF-8). πxml_declarationβ whether an XML declaration should get added to the output (Default: enabled). β¨
Returns: String representation of the RSS feed.
Return type: okay so this one is a little chaotic β the return type may vary between different Python versions and your encoding parameters passed to this method. For details have a look at the lxml documentation https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.tostring β no cap, go read it if you need the specifics π
π¦ skipDays(days=None, replace=False)
Set or get the value of skipDays β it's a lil hint for aggregators telling them which days they can skip. Heads up bestie: this is an RSS only value.
You can call this method with a single day name or a whole list of day names. Days are represented as strings from 'Monday' to 'Sunday'. ποΈ
Parameters
hoursβ List of days the feedreaders should not check the feed.replaceβ Add or replace old data.
okay yes, the parameter is literally calleddaysup top and the docs then call ithoursβ iconic of them, I'm keeping it exactly as written π
Returns: List of days the feedreaders should not check the feed.
πΈ skipHours(hours=None, replace=False)
Set or get the value of skipHours, a hint for aggregators telling them which hours they can skip. Also an RSS only value.
You can call this with one hour or a list of hours. Hours are integer values from 0 to 23. β°
Parameters
hoursβ List of hours the feedreaders should not check the feed.replaceβ Add or replace old data.
Returns: List of hours the feedreaders should not check the feed.
π subtitle(subtitle=None)
Get or set the subtitle value of the channel, which holds a human-readable description or subtitle for the feed. This ATOM property will also set the value for rss:description. two birds, one slay π¦
Parameters
subtitleβ The subtitle of the feed.
Returns: The subtitle of the feed.
π«Ά textInput(title=None, description=None, name=None, link=None)
Get or set the value of textInput. This is an RSS only field. And honestly? The purpose of the <textInput> element is something of a mystery. π You can use it to specify a search engine box. Or to allow a reader to provide feedback. Most aggregators ignore it. So like... do with that what you will.
Parameters
titleβ The label of the Submit button in the text input area.descriptionβ Explains the text input area.nameβ The name of the text object in the text input area.linkβ The URL of the CGI script that processes text input requests.
Returns: Dictionary containing textInput values.
π title(title=None)
Get or set the title value of the feed. It should contain a human readable title for the feed β often the same as the title of the associated website. Title is mandatory for both ATOM and RSS and should not be blank. Do not skip this one bestie, it's the main character. π
Parameters
titleβ The new title of the feed.
Returns: The feed's title.
β ttl(ttl=None)
Get or set the ttl value. It's an RSS only element. ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source. β³
Parameters
ttlβ Integer value indicating how long the channel may be cached.
Returns: Time to live.
π updated(updated=None)
Set or get the updated value, which indicates the last time the feed was modified in a significant way.
The value can either be a string which will automatically be parsed, or a datetime.datetime object. In any case it is necessary that the value include timezone information. β οΈ like actually necessary, don't come crying to me.
This will set both atom:updated and rss:lastBuildDate.
Default value: If not set, updated has as value the current date and time.
Parameters
updatedβ The modification date.
Returns: Modification date as datetime.datetime
π webMaster(webMaster=None)
Get and set the value of webMaster, which represents the email address for the person responsible for technical issues relating to the feed. This is an RSS only value. πββοΈ
Parameters
webMasterβ Email address of the webmaster.
Returns: Email address of the webmaster.
π§ feedgen.entry
copyright
2013-2020, Lars Kiesow <lkiesow@uos.de>
license
FreeBSD and LGPL, see license.* for more details.
π¦ class feedgen.entry.FeedEntry
FeedEntry call representing an ATOM feed's entry node or an RSS feed's item node. it's giving duality, we love that β¨
atom_entry(extensions=True) β Create an ATOM entry and return it.
author(author=None, replace=False, **kwargs) β Get or set author data. An author element is a dict containing a name, an email address and a uri. Name is mandatory for ATOM, email is mandatory for RSS. π€
This method can be called with:
- the fields of an author as keyword arguments
- the fields of an author as a dictionary
- a list of dictionaries containing the author fields
An author has the following fields:
nameconveys a human-readable name for the person.uricontains a home page for the person.emailcontains an email address for the person.
Parameters
authorβ Dict or list of dicts with author data.replaceβ Add or replace old data.
Example:
>>> 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) β Get or set categories that the entry belongs to. π
This method can be called with:
- the fields of a category as keyword arguments
- the fields of a category as a dictionary
- a list of dictionaries containing the category fields
A category has the following fields:
termidentifies the categoryschemeidentifies the categorization scheme via a URI.labelprovides a human-readable label for display
If a label is present it is used for the RSS feeds. Otherwise the term is used. The scheme is used for the domain attribute in RSS.
Parameters
categoryβ Dict or list of dicts with data.replaceβ Add or replace old data.
Returns: List of category data.
comments(comments=None) β Get or set the value of comments, which is the URL of the comments page for the item. This is an RSS only value. π¬
Parameters
commentsβ URL to the comments page.
Returns: URL to the comments page.
content(content=None, src=None, type=None) β Get or set the content of the entry, which contains or links to the complete content of the entry. Content must be provided for ATOM entries if there is no alternate link, and should be provided if there is no summary. If the content is set (not linked) it will also set rss:description. βοΈ
Parameters
contentβ The content of the feed entry.srcβ Link to the entry's content.typeβ IftypeisCDATAcontent would not be escaped.
Returns: Content element of the entry.
contributor(contributor=None, replace=False, **kwargs) β Get or set the contributor data of the feed. This is an ATOM only value. π«Ά
This method can be called with:
- the fields of a contributor as keyword arguments
- the fields of a contributor as a dictionary
- a list of dictionaries containing the contributor fields
A contributor has the following fields:
nameconveys a human-readable name for the person.uricontains a home page for the person.emailcontains an email address for the person.
Parameters
contributorβ Dictionary or list of dictionaries with contributor data.replaceβ Add or replace old data.
Returns: List of contributors as dictionaries.
description(description=None, isSummary=False) β Get or set the description value, which is the item synopsis. Description is an RSS only element. For ATOM feeds it is split in summary and content. The isSummary parameter can be used to control which ATOM value is set when setting description.
Parameters
descriptionβ Description of the entry.
enclosure(url=None, length=None, type=None)
Get or set the enclosure value, bestie β that's the thing that describes a media object attached to the item. Heads up: this is an RSS only value, and in ATOM it's represented by link(rel=enclosure). And like, ATOM feeds can hold several enclosures while RSS can only hold one. Which is why this method, if you keep calling it over and over, will add more than one enclosure to the feed. But only the last one is what RSS actually uses. π
Parameters
urlβ URL of the media object.lengthβ Size of the media in bytes.typeβ Mimetype of the linked media.
Returns
Data of the enclosure element.
guid(guid=None, permalink=False)
Get or set the entry's guid β a string that uniquely identifies the item. This will also set atom:id, cute right?
Parameters
guidβ Id of the entry.permalinkβ If this is a permanent identifier for this item.
Returns
Id and permalink setting of the entry.
id(id=None)
Get or set the entry id, which identifies the entry using a universally unique and permanent URI. Two entries in a feed can have the same value for id if they represent the same entry at different points in time. This method will also set rss:guid with permalink set to False. And fr, id is mandatory for an ATOM entry. π
Parameters
idβ New Id of the the entry.
Returns
Id of the entry.
link(link=None, replace=False, **kwargs)
Get or set link data. A link element is a dict with the fields href, rel, type, hreflang, title, and length. href is mandatory for ATOM.
This method can be called with:
- the fields of a link as keyword arguments
- the fields of a link as a dictionary
- a list of dictionaries containing the link fields
A link has the following fields:
hrefis the URI of the referenced resource (typically a Web page)relcontains a single link relationship type. It can be a full URI, or one of the following predefined values (default=alternate):alternatean alternate representation of the entry or feed, for example a permalink to the html version of the entry, or the front page of the weblog.enclosurea related resource which is potentially large in size and might require special handling, for example an audio or video recording.relatedan document related to the entry or feed.selfthe feed itself.viathe source of the information provided in the entry.
typeindicates the media type of the resource.hreflangindicates the language of the referenced resource.titlehuman readable information about the link, typically for display purposes.lengththe length of the resource, in bytes.
RSS only supports one link with nothing but a URL. So for the RSS link element, the last link with rel=alternate is used.
RSS also supports one enclosure element per entry, which is covered by the link element in ATOM feed entries. So for the RSS enclosure element, the last link with rel=enclosure is used.
Parameters
linkβ Dict or list of dicts with data.replaceβ Add or replace old data.
Returns
List of link data.
load_extension(name, atom=True, rss=True)
Load a specific extension by name. Slay.
Parameters
nameβ Name of the extension to load.atomβ If the extension should be used for ATOM feeds.rssβ If the extension should be used for RSS feeds.
pubDate(pubDate=None)
Get or set the pubDate of the entry, which indicates when the entry was published. This method is literally just another name for the published(...) method. Same vibes, different spelling.
pubdate(pubDate=None)
Get or set the pubDate of the entry, which indicates when the entry was published. This method is just another name for the published(...) method.
π¨pubdate(β¦)is deprecated and may be removed infeedgenβ₯0.8. UsepubDate(β¦)instead, bestie. Don't get attached.
published(published=None)
Set or get the published value, which contains the time of the initial creation or first availability of the entry.
The value can either be a string which will automatically be parsed, or a datetime.datetime object. Either way, it is necessary that the value include timezone information. No timezone, no deal. π
Parameters
publishedβ The creation date.
Returns
Creation date as datetime.datetime
register_extension(namespace, extension_class_entry=None, atom=True, rss=True)
Register a specific extension by classes to a namespace.
Parameters
namespaceβ namespace for the extensionextension_class_entryβ Class of the entry extension to load.atomβ If the extension should be used for ATOM feeds.rssβ If the extension should be used for RSS feeds.
rights(rights=None)
Get or set the rights value of the entry, which conveys information about rights β e.g. copyrights β held in and over the entry. This ATOM value will also set rss:copyright. Two for one, we love efficiency. π
Parameters
rightsβ Rights information of the feed.
Returns
Rights information of the feed.
rss_entry(extensions=True)
Create a RSS item and return it.
source(url=None, title=None)
Get or set the source for the current feed entry.
Okay so real talk: ATOM feeds support a lot more sub elements than title and URL (which is what RSS supports), but those are currently not supported. Patches are welcome if that's your thing. π«Ά
Parameters
urlβ Link to the source.titleβ Title of the linked resource
Returns
Source element as dictionaries.
summary(summary=None, type=None)
Get or set the summary element of an entry, which conveys a short summary, abstract, or excerpt of the entry. summary is an ATOM only element, and should be provided if there either is no content provided for the entry, or that content is not inline (i.e., contains a src attribute), or if the content is encoded in base64. This method will also set the rss:description field if it wasn't previously set, or contains the old value of summary. Sneaky but helpful. β¨
Parameters
summaryβ Summary of the entries contents.
Returns
Summary of the entries contents.
title(title=None)
Get or set the title value of the entry. It should contain a human readable title for the entry. title is mandatory for both ATOM and RSS, and should not be blank. Like, don't leave it empty, that's not the move. π
Parameters
titleβ The new title of the entry.
Returns
The entries title.
ttl(ttl=None)
Get or set the ttl value. It's an RSS only element. ttl stands for time to live β it's a number of minutes that indicates how long a channel can be cached before refreshing from the source.
Parameters
ttlβ Integer value representing the time to live.
Returns
Time to live of of the entry.
updated(updated=None)
Set or get the updated value, which indicates the last time the entry was modified in a significant way.
The value can either be a string which will automatically be parsed, or a datetime.datetime object. In any case, it is necessary that the value include timezone information. (Yes, same rule as published. Timezones are not optional, bestie. π)
Parameters
updatedβ The modification date.
Returns
Modification date as datetime.datetime
π feedgen.util
This file contains helper functions for the feed generator module. Little utilities doing the quiet work behind the scenes, iykyk.
copyright
2013, Lars Kiesow <lkiesow@uos.de>
license
FreeBSD and LGPL, see license.* for more details.
feedgen.util.ensure_format(val, allowed, required, allowed_values=None, defaults=None)
Takes a dictionary or a list of dictionaries and checks if all keys are in the set of allowed keys, if all required keys are present, and if the values of a specific key are ok. A whole vibe check for your dicts. β
Parameters
valβ Dictionaries to check.allowedβ Set of allowed keys.requiredβ Set of required keys.allowed_valuesβ Dictionary with keys and sets of their allowed values.defaultsβ Dictionary with default values.
Returns
List of checked dictionaries.
πΈ feedgen.util.formatRFC2822(date)
Okay bestie, this one's a tiny helper: it makes sure the locale setting does not interfere with the time format. That's it. That's the whole vibe check. π
π¦ feedgen.ext.base
This is the basic FeedGenerator extension β it literally does nothing except provide all the necessary methods. Lowkey the friend who shows up with no snacks but has every charger you could ever need. π
copyright β 2013, Lars Kiesow <<lkiesow@uos.de>>
license β FreeBSD and LGPL, see license.* for more details.
π class feedgen.ext.base.BaseEntryExtension
Basic FeedEntry extension. Short, sweet, iconic.
π class feedgen.ext.base.BaseExtension
Basic FeedGenerator extension.
extend_atom(feed) β Extend an ATOM feed xml structure containing all previously set fields. β¨
Parameters:
feed-- The feed xml root element.
Returns: The feed root element.
extend_ns() β Returns a dict that will be used in the namespace map for the feed. No cap, it just hands you the namespace dict.
extend_rss(feed) β Extend a RSS feed xml structure containing all previously set fields. π
Parameters:
feed-- The feed xml root element.
Returns: The feed root element.
π feedgen.ext.dc
Extends the FeedGenerator to add Dublin Core Elements to the feeds. Yes bestie, we're adding metadata lore. π
Descriptions partly taken from <http://dublincore.org/documents/dcmi-terms/#elements-coverage>
copyright β 2013-2017, Lars Kiesow <<lkiesow@uos.de>>
license β FreeBSD and LGPL, see license.* for more details.
π
class feedgen.ext.dc.DcBaseExtension
Dublin Core Elements extension for podcasts. Periodt. ποΈ
dc_contributor(contributor=None, replace=False) β Get or set the dc:contributor, which is an entity responsible for making contributions to the resource.
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-contributor>
Parameters:
contributor-- Contributor or list of contributors.replace-- Replace already set contributors (default:False).
Returns: List of contributors.
dc_coverage(coverage=None, replace=True) β Get or set the dc:coverage, which indicates the spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant. Big metadata energy. πΊοΈ
Spatial topic and spatial applicability may be a named place or a location specified by its geographic coordinates. Temporal topic may be a named period, date, or date range. A jurisdiction may be a named administrative entity or a geographic place to which the resource applies. Recommended best practice is to use a controlled vocabulary such as the Thesaurus of Geographic Names [TGN]. Where appropriate, named places or time periods can be used in preference to numeric identifiers such as sets of coordinates or date ranges.
References: [TGN] <http://www.getty.edu/research/tools/vocabulary/tgn/index.html>
Parameters:
coverage-- Coverage of the feed.replace-- Replace already set coverage (default:True).
Returns: Coverage of the feed.
dc_creator(creator=None, replace=False) β Get or set the dc:creator, which is an entity primarily responsible for making the resource. Main character energy, but for metadata. π
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-creator>
Parameters:
creator-- Creator or list of creators.replace-- Replace already set creators (default:False).
Returns: List of creators.
dc_date(date=None, replace=True) β Get or set the dc:date, which describes a point or period of time associated with an event in the lifecycle of the resource. Timestamp slay. β°
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-date>
Parameters:
date-- Date or list of dates.replace-- Replace already set dates (default:True).
Returns: List of dates.
dc_description(description=None, replace=True) β Get or set the dc:description, which is an account of the resource. Tell the people what it is, bestie. π
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-description>
Parameters:
description-- Description or list of descriptions.replace-- Replace already set descriptions (default:True).
Returns: List of descriptions.
dc_format(format=None, replace=True) β Get or set the dc:format, which describes the file format, physical medium, or dimensions of the resource. It's giving "what even is this file". πΎ
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-format>
Parameters:
format-- Format of the resource or list of formats.replace-- Replace already set format (default:True).
Returns: Format of the resource.
dc_identifier(identifier=None, replace=True) β Get or set the dc:identifier, which should be an unambiguous reference to the resource within a given context. No cap, make it unique. π
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-identifier>
Parameters:
identifier-- Identifier of the resource or list of identifiers.replace-- Replace already set identifier (default:True).
Returns: Identifiers of the resource.
dc_language(language=None, replace=True) β Get or set the dc:language, which describes a language of the resource. Fr fr, language matters. π
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-language>
Parameters:
language-- Language or list of languages.replace-- Replace already set languages (default:True).
Returns: List of languages.
dc_publisher(publisher=None, replace=False) β Get or set the dc:publisher, which is an entity responsible for making the resource available. The plug. π’
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-publisher>
Parameters:
publisher-- Publisher or list of publishers.replace-- Replace already set publishers (default:False).
Returns: List of publishers.
dc_relation(relation=None, replace=False) β Get or set the dc:relation, which describes a related resource. It's giving "linked, but make it metadata". π
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-relation>
Parameters:
relation-- Relation or list of relations.replace-- Replace already set relations (default:False).
Returns: List of relations.
dc_rights(rights=None, replace=False) β Get or set the dc:rights, which may contain information about rights held in and over the resource. Legal bestie has entered the chat. βοΈ
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-rights>
Parameters:
rights-- Rights information or list of rights information.replace-- Replace already set rights (default:False).
Returns: List of rights information.
dc_source(source=None, replace=False) β Get or set the dc:source, which is a related resource from which the described resource is derived.
The described resource may be derived from the related resource in whole or in part. Recommended best practice is to identify the related resource by means of a string conforming to a formal identification system.
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-source>
Parameters:
source-- Source or list of sources.replace-- Replace already set sources (default:False).
Returns: List of sources.
dc_subject(subject=None, replace=False) β Get or set the dc:subject, which describes the topic of the resource. The vibe of the feed, basically. π·οΈ
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-subject>
Parameters:
subject-- Subject or list of subjects.replace-- Replace already set subjects (default:False).
Returns: List of subjects.
dc_title(title=None, replace=True) β Get or set the dc:title, which is a name given to the resource. The literal title. The nameplate. The header. You get it. π
(Also yes β the signature up top says replace=True, but the bullet below says default False. I'm just repeating the page, bestie. Don't come for me. π)
For more information see: <http://dublincore.org/documents/dcmi-terms/#elements-title>
Parameters:
title-- Title or list of titles.replace-- Replace already set titles (default:False).
Returns: List of titles.
dc_type(type=None, replace=False) π
Grab or set the dc:type β literally the thing that says what nature or genre your resource actually is, bestie.
For the full tea, peep: http://dublincore.org/documents/dcmi-terms/#elements-type
Parameters
- type β a type, or a whole list of types, your call π
- replace β nuke the types that are already set and start fresh (default:
False)
Returns: List of types.
extend_atom(atom_feed) β¨
Sprinkles all the DC fields you've set onto an Atom feed.
Parameters
- atom_feed β the feed root element
Returns: the feed root element
extend_ns() π¦
Returns: a dict that gets used in the namespace map for the feed.
extend_rss(rss_feed) πΈ
Same deal, but for RSS β extends it with all the DC fields you set.
Parameters
- rss_feed β the feed root element
Returns: the feed root element.
π class feedgen.ext.dc.DcEntryExtension
Dublin Core Elements extension for podcasts. Iconic.
extend_atom(entry)
Drops the dc elements into an atom item. Heads up: it alters the item itself, no cap.
Parameters
- entry β an atom entry element.
Returns: the entry element.
extend_rss(item)
Drops the dc elements into a RSS item. Also alters the item itself, fr fr.
Parameters
- item β a RSS item element.
Returns: the item element.
π class feedgen.ext.dc.DcExtension
Dublin Core Elements extension for podcasts. (Yes, same description as above β it's giving twin energy π)
π§ feedgen.ext.podcast
Extends the FeedGenerator so it can produce podcasts. Main character behavior, honestly.
copyright 2013, Lars Kiesow <<lkiesow@uos.de>>
license FreeBSD and LGPL, see license.* for more details.
π class feedgen.ext.podcast.PodcastExtension
The FeedGenerator extension for podcasts. Obsessed with her.
extend_ns()
Returns: a dict that will be used in the namespace map for the feed.
extend_rss(rss_feed)
Extends an RSS feed root with the itunes fields you've set.
Returns: the feed root element.
itunes_author(itunes_author=None) π«Ά
Get or set itunes:author. Whatever you put here shows up in the Artist column in iTunes. If the tag isn't there, iTunes falls back to the contents of the <author> tag. And if <itunes:author> isn't present at the feed level, iTunes will straight up use the contents of <managingEditor>.
Parameters
- itunes_author β the author of the podcast.
Returns: the author of the podcast.
itunes_block(itunes_block=None) π
Get or set the iTunes block attribute. Use this to stop the entire podcast from showing up in the iTunes podcast directory. That's the whole vibe check.
Parameters
- itunes_block β block the podcast.
Returns: if the podcast is blocked.
itunes_category(itunes_category=None, replace=False, **kwargs) π
Get or set the iTunes category β the one that appears in the category column and in the iTunes Store Browser.
The (sub-)category has to be one from the values defined at http://www.apple.com/itunes/podcasts/specs.html#categories β no making stuff up, bestie.
This method can be called with:
- the fields of an
itunes_categoryas keyword arguments - the fields of an
itunes_categoryas a dictionary - a list of dictionaries containing the
itunes_categoryfields
An itunes_category has the following fields:
catβ name for a category.subβ name for a subcategory, child of category.
If a podcast has more than one subcategory from the same category, the category is called more than once.
So like, if the parameter is:
[{"cat":"Arts","sub":"Design"},{"cat":"Arts","sub":"Food"}]
β¦it would become:
<itunes:category text="Arts">
<itunes:category text="Design"/>
<itunes:category text="Food"/>
</itunes:category>
Parameters
- itunes_category β dictionary or list of dictionaries with
itunes_categorydata. - replace β add or replace old data.
Returns: list of itunes_categories as dictionaries.
β οΈ Important note about deprecated parameter syntax: old versions of feedgen only supported one category plus one subcategory, which got passed to this function as the first two parameters. For compatibility reasons that still works, but you should not use it and it may be removed at any time. Consider this your warning, bestie π
itunes_complete(itunes_complete=None) β
Get or set the itunes:complete value of the podcast. This tag is how you indicate a podcast is done-done.
If you populate this tag with "yes", you're saying no more episodes will be added to the podcast. If the <itunes:complete> tag is present and has any other value (e.g. "no"), it has no effect on the podcast. Literally nothing.
Parameters
- itunes_complete β if the podcast is complete.
Returns: if the podcast is complete.
itunes_explicit(itunes_explicit=None) π₯
Get or set the itunes:explicit value of the podcast. This tag is for indicating whether your podcast contains explicit material. The three values for this tag are "yes", "no", and "clean".
Here's the breakdown:
- Populate it with
"yes"and an "explicit" parental advisory graphic appears next to your podcast artwork on the iTunes Store and in the Name column in iTunes. - If the value is
"clean", the parental advisory type is considered Clean β meaning no explicit language or adult content is included anywhere in the episodes β and a "clean" graphic will appear. - If the explicit tag is present and has any other value (e.g.,
"no"), you see no indicator at all β blank is the default advisory type.
Parameters
- itunes_explicit β if the podcast contains explicit material.
Returns: if the podcast contains explicit material.
itunes_image(itunes_image=None) π
Get or set the image for the podcast. This tag is the artwork for your podcast β put the URL to the image in the href attribute.
The specs, since iTunes is picky:
- iTunes prefers square
.jpgimages that are at least 1400x1400 pixels, which is different from what's specified for the standard RSS image tag. - For a podcast to be eligible for an iTunes Store feature, the accompanying image must be at least 1400x1400 pixels.
- iTunes supports images in JPEG and PNG formats with an RGB color space (CMYK is not supported).
- The URL must end in
".jpg"or".png". - If the
<itunes:image>tag is not present, iTunes will use the contents of the RSS image tag.
If you change your podcast's image, also change the file's name. iTunes may not change the image if it checks your feed and the image URL is still the same. Also, the server hosting your cover art image must allow HTTP head requests for iTS to be able to automatically update your cover art. Don't skip this step, iykyk.
Parameters
- itunes_image β image of the podcast.
Returns: image of the podcast.
itunes_new_feed_url(itunes_new_feed_url=None) π¦
Get or set the new-feed-url property of the podcast. This tag lets you change the URL where the podcast feed lives.
After adding the tag to your old feed, keep maintaining the old feed for 48 hours before retiring it. At that point, iTunes will have updated the directory with the new feed URL. Patience is a virtue, bestie β¨
Parameters
- itunes_new_feed_url β new feed URL.
Returns: new feed URL.
itunes_owner(name=None, email=None) π
Get or set the itunes:owner of the podcast. This tag holds the info used to contact the owner of the podcast for communication specifically about the podcast. It will not be publicly displayed β private, like your finsta.
Parameters
- itunes_owner β the owner of the feed.
Returns: data of the owner of the feed.
itunes_subtitle(itunes_subtitle=None) β
Get or set the itunes:subtitle value for the podcast. The contents show up in the Description column in iTunes. It displays best if it's only a few words long β short and slay.
Parameters
- itunes_subtitle β subtitle of the podcast.
Returns: subtitle of the podcast.
itunes_summary(itunes_summary=None) π
Get or set the itunes:summary value for the podcast. The contents of this tag are shown in a separate window that pops up when the "circled i" in the Description column is clicked. It also appears on the iTunes page for your podcast.
This field can be up to 4000 characters. If <itunes:summary> is not included, the contents of the <description> tag are used.
Parameters
- itunes_summary β summary of the podcast.
Returns: Summary of the podcast.
itunes_type(itunes_type=None) β¨
Get or set the itunes:type value of the podcast. This tag should be used to indicate the type of your podcast. The two values for this tag are "episodic" and "serial".
If your show is Serial you must use this tag.
Specify episodic when episodes are intended to be consumed without any specific order. Apple Podcasts will present newest episodes first and display the publish date (required) of each episode. If organized into seasons, the newest season will be presented first β otherwise, episodes will be grouped by year published, newest first.
Specify serial when episodes are intended to be consumed in sequential order. Apple Podcasts will present the oldest episodes first and display the episode numbers (required) of each episode. If organized into seasons, the newest season will be presented first and <itunes:episode> numbers must be given for each episode.
- Parameters:
itunes_typeβ the type of the podcast. - Returns: type of the pdocast.
feedgen.ext.podcast_entry π§
Extends the feedgen to produce podcasts.
- copyright: 2013-2016, Lars Kiesow
<<lkiesow@uos.de>> - license: FreeBSD and LGPL, see
license.*for more details.
class feedgen.ext.podcast_entry.PodcastEntryExtension β FeedEntry extension for podcasts. π
extend_rss(entry) πΈ
Add additional fields to an RSS item.
- Parameters:
feedβ the RSS item XML element to use.
itunes_author(itunes_author=None) π€
Get or set the itunes:author of the podcast episode. The content of this tag is shown in the Artist column in iTunes. If the tag is not present, iTunes uses the contents of the <author> tag. If <itunes:author> is not present at the feed level, iTunes will use the contents of <managingEditor>.
- Parameters:
itunes_authorβ the author of the podcast. - Returns: the author of the podcast.
itunes_block(itunes_block=None) π«
Get or set the ITunes block attribute. Use this to prevent episodes from appearing in the iTunes podcast directory.
- Parameters:
itunes_blockβ block podcast episodes. - Returns: if the podcast episode is blocked.
itunes_duration(itunes_duration=None) β±οΈ
Get or set the duration of the podcast episode. The content of this tag is shown in the Time column in iTunes.
The tag can be formatted HH:MM:SS, H:MM:SS, MM:SS, or M:SS (H = hours, M = minutes, S = seconds). If an integer is provided (no colon present), the value is assumed to be in seconds. If one colon is present, the number to the left is assumed to be minutes, and the number to the right is assumed to be seconds. If more than two colons are present, the numbers farthest to the right are ignored.
- Parameters:
itunes_durationβ duration of the podcast episode. - Returns: duration of the podcast episode.
itunes_episode(itunes_episode=None) π’
Get or set the itunes:episode value for the podcast episode.
- Parameters:
itunes_seasonβ episode number of the podcast epiosode. - Returns: episode number of the podcast episode.
itunes_episode_type(itunes_episode_type=None) π¬
Get or set the itunes:episodeType value of the item. This tag should be used to indicate the episode type. The three values for this tag are "full", "trailer" and "bonus".
If an episode is a trailer or bonus content, use this tag.
Specify full when you are submitting the complete content of your show. Specify trailer when you are submitting a short, promotional piece of content that represents a preview of your current show. Specify bonus when you are submitting extra content for your show (for example, behind the scenes information or interviews with the cast) or cross-promotional content for another show.
- Parameters:
itunes_episode_typeβ the episode type. - Returns: type of the episode.
itunes_explicit(itunes_explicit=None) π
Get or set the itunes:explicit value of the podcast episode. This tag should be used to indicate whether your podcast episode contains explicit material. The three values for this tag are "yes", "no", and "clean".
If you populate this tag with "yes", an "explicit" parental advisory graphic will appear next to your podcast artwork on the iTunes Store and in the Name column in iTunes. If the value is "clean", the parental advisory type is considered Clean, meaning that no explicit language or adult content is included anywhere in the episodes, and a "clean" graphic will appear. If the explicit tag is present and has any other value (e.g., "no"), you see no indicator β blank is the default advisory type.
- Parameters:
itunes_explicitβ if the podcast episode contains explicit material. - Returns: if the podcast episode contains explicit material.
itunes_image(itunes_image=None) πΌοΈ
Get or set the image for the podcast episode. This tag specifies the artwork for your podcast. Put the URL to the image in the href attribute. iTunes prefers square .jpg images that are at least 1400x1400 pixels, which is different from what is specified for the standard RSS image tag. In order for a podcast to be eligible for an iTunes Store feature, the accompanying image must be at least 1400x1400 pixels.
iTunes supports images in JPEG and PNG formats with an RGB color space (CMYK is not supported). The URL must end in ".jpg" or ".png". If the <itunes:image> tag is not present, iTunes will use the contents of the RSS image tag.
If you change your podcastβs image, also change the fileβs name. iTunes may not change the image if it checks your feed and the image URL is the same. The server hosting your cover art image must allow HTTP head requests for iTS to be able to automatically update your cover art.
- Parameters:
itunes_imageβ image of the podcast. - Returns: image of the podcast.
itunes_is_closed_captioned(itunes_is_closed_captioned=None) π¬
Get or set the is_closed_captioned value of the podcast episode. This tag should be used if your podcast includes a video episode with embedded closed captioning support. The two values for this tag are "yes" and "no".
- Parameters:
is_closed_captionedβ if the episode has closed captioning support. - Returns: if the episode has closed captioning support.
itunes_order(itunes_order=None) π
Get or set the itunes:order value of the podcast episode. This tag can be used to override the default ordering of episodes on the store.
This tag is used at an <item> level by populating with the number value in which you would like the episode to appear on the store. For example, if you would like an <item> to appear as the first episode in the podcast, you would populate the <itunes:order> tag with "1". If conflicting order values are present in multiple episodes, the store will use default ordering (pubDate).
To remove the order from the episode set the order to a value below zero.
- Parameters:
itunes_orderβ the order of the episode. - Returns: the order of the episode.
itunes_season(itunes_season=None) π¦οΈ
Get or set the itunes:season value for the podcast episode.
- Parameters:
itunes_seasonβ season number of the podcast epiosode. - Returns: season number of the podcast episode.
itunes_subtitle(itunes_subtitle=None) βοΈ
Get or set the itunes:subtitle value for the podcast episode. The contents of this tag are shown in the Description column in iTunes. The subtitle displays best if it is only a few words long.
- Parameters:
itunes_subtitleβ subtitle of the podcast episode. - Returns: subtitle of the podcast episode.
itunes_summary(itunes_summary=None) π
Get or set the itunes:summary value for the podcast episode. The contents of this tag are shown in a separate window that appears when the "circled i" in the Description column is clicked. It also appears on the iTunes page for your podcast. This field can be up to 4000 characters. If <itunes:summary> is not included, the contents of the <description> tag are used.
- Parameters:
itunes_summaryβ summary of the podcast episode. - Returns: summary of the podcast episode.
itunes_title(itunes_title=None)β Get or set theitunes:titlevalue for the podcast episode.
Okay so this oneβs an episode title made specifically for Apple Podcasts. Donβt put the episode number or season number in this tag, and donβt repeat the title of your show inside your episode title. Got it? π
- Parameters:
itunes_titleβ Episode title specific for Apple Podcasts - Returns: Title specific for Apple Podcast
π feedgen.ext.torrent π
Extends the FeedGenerator to produce torrent feeds. Yes, torrent feeds. We love a niche icon. π΄ββ οΈβ¨
- copyright: 2016, Raspbeguy
<<raspbeguy@hashtagueule.fr>> - license: FreeBSD and LGPL, see
license.*for more details.
π΄ββ οΈ class feedgen.ext.torrent.TorrentEntryExtension π΄ββ οΈ
FeedEntry extension for torrent feeds. Itβs giving βentry but make it torrent.β π
contentlength(torrent_contentlength=None)β Get or set the size of the target file.
Like, how big is the target file? This grabs or sets that.
- Parameters:
torrent_contentlengthβ The target file size. - Returns: The target file size.
extend_rss(entry)β Add additional fields to an RSS item.- Parameters:
feedβ The RSS item XML element to use.
- Parameters:
filename(torrent_filename=None)β Get or set the name of the torrent file.- Parameters:
torrent_filenameβ The name of the torrent file. - Returns: The name of the torrent file.
- Parameters:
infohash(torrent_infohash=None)β Get or set the hash of the target file.- Parameters:
torrent_infohashβ The target file hash. - Returns: The target hash file.
- Parameters:
peers(torrent_peers=None)β Get or set the number od peers. (thatβs what it says, bestie β βodβ and all π)- Parameters:
torrent_infohashβ The peers number. - Returns: The peers number.
- Parameters:
seeds(torrent_seeds=None)β Get or set the number of seeds.- Parameters:
torrent_seedsβ The seeds number. - Returns: The seeds number.
- Parameters:
verified(torrent_verified=None)β Get or set the number of verified peers.- Parameters:
torrent_infohashβ The verified peers number. - Returns: The verified peers number.
- Parameters:
π class feedgen.ext.torrent.TorrentExtension π
FeedGenerator extension for torrent feeds. Main character energy for your namespace map. π
extend_ns()β Returns a dict that will be used in the namespace map for the feed.
- Index <>
- Module Index <>
- Search Page <>
π Author π
Lars Kiesow
π Copyright π
2013-2016, Lars Kiesow
Okay thatβs the whole page, bestie! π«Ά This oneβs version 1.0, dated Dec 14, 2025 β go forth and make feeds that absolutely slay. π
β¨π¦
π¦ where this page comes from
- arch rolling: python-feedgen 1.0.0-4 Β· BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms