Uncommon Atom Elements

These elements are less common, but are useful for niche applications and may be present in any Atom feed.

Besides an author, each Atom feed or entry can have an arbitrary number of contributors. Universal Feed Parser makes these available as a list.

Example: Accessing contributors

>>> import feedparser
>>> d = feedparser.parse('http://feedparser.org/docs/examples/atom.xml')
>>> e = d.entries[0]
>>> len(e.contributors)
2
>>> e.contributors[0]
{'name': u'Joe',
 'url': u'http://example.org/joe/',
 'email': u'joe@example.org'}
>>> e.contributors[1]
{'name': u'Sam',
 'url': u'http://example.org/sam/',
 'email': u'sam@example.org'}

Besides an alternate link, each Atom feed or entry can have an arbitrary number of other links. Each link is distinguished by its type attribute, which is a MIME-style content type, and its rel attribute. Possible rel values and their meanings are documented on the Atom project site.

Example: Accessing multiple links

>>> import feedparser
>>> d = feedparser.parse('http://feedparser.org/docs/examples/atom.xml')
>>> e = d.entries[0]
>>> len(e.links)
3
>>> e.links[0]
{'rel': u'alternate',
 'type': u'text/html',
 'href': u'http://example.org/entry/3'}
>>> e.links[1]
{'rel': u'service.edit',
 'type': u'application/atom+xml',
 'href': u'http://example.org/entry/3',
 'title': u'Atom API endpoint to edit this entry'}
>>> e.links[2]
{'rel': u'service.post',
 'type': u'application/atom+xml',
 'href': u'http://example.org/api/comment/3',
 'title': u'Atom API endpoint to add comments to this entry'}
Note
For more examples of accessing Atom elements, see the annotated example Atom.
← Uncommon RSS Elements
Testing for Existence →