Fix README sample python code

master
pictuga 2014-05-21 15:05:35 +02:00
parent 49f0be1919
commit 16713e6d2a
1 changed files with 4 additions and 7 deletions

View File

@ -99,19 +99,16 @@ However here is a quick draft of what your code should you like if you intend to
```python ```python
import morss import morss
url = 'http://newspaper.example/feed.xml' url = 'http://newspaper.example/feed.xml'
options = morss.ParseOptions() # there's no easy way to pass arguments by hand from python so far... options = morss.ParseOptions() # there's no easy way to pass arguments by hand from python so far...
cache_path = '/tmp/morss-cache' # cache folder, needs write permission cache_path = '/tmp/morss-cache' # cache folder, needs write permission
url, cache = Init(url, cache_path, options) url, cache = Init(url, cache_path, options)
RSS = Fetch(url, cache, options) # this only grabs the RSS feed rss = Fetch(url, cache, options) # this only grabs the RSS feed
RSS = Gather(RSS, url, cache, options) # this fills the feed and cleans it up rss = Gather(rss, url, cache, options) # this fills the feed and cleans it up
After(RSS, options) # formats final feed
output_xml = rss.tostring(xml_declaration=True, encoding='UTF-8') output = After(rss, options) # formats final feed
output_json = rss.tojson()
output_json_indented = rss.tojson(indent=4)
output_csv = rss.tocsv()
``` ```
##Cache information ##Cache information