utils.feedgenerator.SyndicationFeed

class SyndicationFeed [source]

Base class for all syndication feeds. Subclasses should provide write().

__init__(title, link, description, language=None, author_email=None, author_name=None, author_link=None, subtitle=None, categories=None, feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs) [source]

Initialize the feed with the given dictionary of metadata, which applies to the entire feed.

Any extra keyword arguments you pass to __init__ will be stored in self.feed.

All parameters should be Unicode objects, except categories, which should be a sequence of Unicode objects.

add_item(title, link, description, author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None, updateddate=None, enclosures=None, **kwargs) [source]

Adds an item to the feed. All args are expected to be Python unicode objects except pubdate and updateddate, which are datetime.datetime objects, enclosure, which is an Enclosure instance, and enclosures, which is a list of Enclosure instances.

Deprecated since version 1.9: The enclosure keyword argument is deprecated in favor of the new enclosures keyword argument which accepts a list of Enclosure objects.

num_items() [source]
root_attributes() [source]

Return extra attributes to place on the root (i.e. feed/channel) element. Called from write().

add_root_elements(handler) [source]

Add elements in the root (i.e. feed/channel) element. Called from write().

item_attributes(item) [source]

Return extra attributes to place on each item (i.e. item/entry) element.

add_item_elements(handler, item) [source]

Add elements on each item (i.e. item/entry) element.

write(outfile, encoding) [source]

Outputs the feed in the given encoding to outfile, which is a file-like object. Subclasses should override this.

writeString(encoding) [source]

Returns the feed in the given encoding as a string.

latest_post_date() [source]

Returns the latest pubdate or updateddate for all items in the feed. If no items have either of these attributes this returns the current date/time.

doc_Django
2016-10-09 18:40:27
Comments
Leave a Comment

Please login to continue.