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 inself.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 exceptpubdate
andupdateddate
, which aredatetime.datetime
objects,enclosure
, which is anEnclosure
instance, andenclosures
, which is a list ofEnclosure
instances.Deprecated since version 1.9: The
enclosure
keyword argument is deprecated in favor of the newenclosures
keyword argument which accepts a list ofEnclosure
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
orupdateddate
for all items in the feed. If no items have either of these attributes this returns the current date/time.
Please login to continue.