GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • index
  • next
  • previous
  • feedparser 5.2.0 documentation
  • Basic Features
  • Uncommon Atom Elements
  • Show Source

This view

  • Original page
  • New address

GeezerVison is showing pythonhosted.org — Uncommon Atom Elements — feedparser 5.2.0 documentation

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.

Accessing contributors¶

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

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.

Accessing multiple links¶

>>> import feedparser
>>> d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml')
>>> e = d.entries[0]
>>> len(e.links)
4
>>> e.links[0]
{'rel': u'alternate',
'type': u'text/html',
'href': u'http://example.org/entry/3'}
>>> e.links[1]
{'rel': u'related',
'type': u'text/html',
'href': u'http://search.example.com/'}
>>> e.links[2]
{'rel': u'via',
'type': u'text/html',
'href': u'http://toby.example.com/examples/atom10'}
>>> e.links[3]
{'rel': u'enclosure',
'type': u'video/mpeg4',
'href': u'http://www.example.com/movie.mp4',
'length': u'42301'}

Note

For more examples of accessing Atom elements, see the annotated examples Atom 1.0 and Atom 0.3.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.