Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (44 sloc) 1.843 kB
40a066a styling fixes
David Cramer authored
1 Feedreader
2 ----------
3
806e976 Initial commit and separation from lifestrm project
David Cramer authored
4 A universal feed parser designed to operate on top of the lxml interface.
5
6 This is a VERY rough readme, and this project is very early in development. It however, is used to power Lifestrm.com.
7
40a066a styling fixes
David Cramer authored
8 Our mission was simple:
806e976 Initial commit and separation from lifestrm project
David Cramer authored
9
10 - Don't write an XML parser (we use lxml)
11 - Keep it transparent, but allow easy access to underlying objects.
12 - Support as many services as possible, and make accessing their media easy.
13
14 Features
40a066a styling fixes
David Cramer authored
15 --------
806e976 Initial commit and separation from lifestrm project
David Cramer authored
16
17 - RSS 2.0 (incl. media enclosures)
18 - Atom 1.0 (incl. link enclosures)
19
20 Installation
40a066a styling fixes
David Cramer authored
21 ------------
806e976 Initial commit and separation from lifestrm project
David Cramer authored
22
23 - http://codespeak.net/lxml/
24 - http://labix.org/python-dateutil
25
26 Usage
40a066a styling fixes
David Cramer authored
27 -----
806e976 Initial commit and separation from lifestrm project
David Cramer authored
28
29 There are several methods which are usable to parse a feed::
30
343a482 Moved feedreader.feedreader to feedreader.parser. You now MUST use fe…
David Cramer authored
31 from feedreader.parser import from_url
806e976 Initial commit and separation from lifestrm project
David Cramer authored
32 parsed = from_url('http://www.domain.com/rss.xml')
33
343a482 Moved feedreader.feedreader to feedreader.parser. You now MUST use fe…
David Cramer authored
34 from feedreader.parser import from_string
806e976 Initial commit and separation from lifestrm project
David Cramer authored
35 parsed = from_string(open('my.rss', 'r').read())
36
343a482 Moved feedreader.feedreader to feedreader.parser. You now MUST use fe…
David Cramer authored
37 from feedreader.parser import from_file
806e976 Initial commit and separation from lifestrm project
David Cramer authored
38 parsed = from_file(open('my.rss', 'r'))
39
40 Once you have initialized the parser, you will be able to access supported elements
41 via a natural property syntax::
42
43 >>> parsed.title
44 My feed title
45 >>> parsed.link
46 http://www.domain.com/rss.xml
47 >>> parsed.published
48 datetime.datetime(2009, 8, 13, 2, 53, 11, 867908)
49
50 For the entries in a feed, you may use the `entries` accessor::
51
52 >>> parsed.entries
53 [<Entry ...>, <Entry ...>, <Entry ...>]
54
55 And each entry also supports similar common attributes::
56
57 >>> parsed.entries[0].title
58 My Article Name
59 >>> parsed.entries[0].link
60 http://www.domain.com/my-article-name
61
62 Keeping with our goals of allowing access to underlying XML, feedreader is a simple proxy. What this means is that while we provide accessors for many common attributes across feeds, you can still get at any XML element fairly easily::
63
64 >>> parsed.myUnsupportedXMLTag
65 (Fill me in with whatever lxml would return)
Something went wrong with that request. Please try again.