| Line | |
|---|
| 1 | ======= |
|---|
| 2 | sources |
|---|
| 3 | ======= |
|---|
| 4 | |
|---|
| 5 | All kind of sources can be read, and new readers registered. |
|---|
| 6 | The system provides for example an RSS reader. |
|---|
| 7 | |
|---|
| 8 | We have a rss file to test:: |
|---|
| 9 | |
|---|
| 10 | >>> from sources import sourcing |
|---|
| 11 | >>> import os |
|---|
| 12 | >>> dirname = os.path.dirname(sourcing.__file__) |
|---|
| 13 | >>> dirname = os.path.split(dirname)[0] |
|---|
| 14 | >>> location = os.path.join(dirname, 'tests', 'feed.xml') |
|---|
| 15 | |
|---|
| 16 | Let's try to read it:: |
|---|
| 17 | |
|---|
| 18 | >>> targets = (('rss', location),) |
|---|
| 19 | >>> entries = sourcing.get_entries(targets) |
|---|
| 20 | >>> res = entries.next() |
|---|
| 21 | >>> len(res) |
|---|
| 22 | 165 |
|---|
| 23 | >>> res[0]['content'] |
|---|
| 24 | u"CSSEdit 2 is a major upgrade ... check it out!" |
|---|
| 25 | |
|---|