Change README to enjoy Github syntax highlighting
parent
433374b227
commit
49f0be1919
26
README.md
26
README.md
|
@ -97,20 +97,22 @@ For example: `python2.7 PATH/TO/MORSS/morss.py http://feeds.bbci.co.uk/news/rss.
|
|||
The code was not optimized to be used as a library. Therefore you can't really pass options to morss (see Arguments above), unless you rewrite the `ParseOptions` class.
|
||||
However here is a quick draft of what your code should you like if you intend to use morss as a library.
|
||||
|
||||
import morss
|
||||
url = 'http://newspaper.example/feed.xml'
|
||||
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
|
||||
url, cache = Init(url, cache_path, options)
|
||||
```python
|
||||
import morss
|
||||
url = 'http://newspaper.example/feed.xml'
|
||||
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
|
||||
url, cache = Init(url, cache_path, options)
|
||||
|
||||
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
|
||||
After(RSS, options) # formats final 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
|
||||
After(RSS, options) # formats final feed
|
||||
|
||||
output_xml = rss.tostring(xml_declaration=True, encoding='UTF-8')
|
||||
output_json = rss.tojson()
|
||||
output_json_indented = rss.tojson(indent=4)
|
||||
output_csv = rss.tocsv()
|
||||
output_xml = rss.tostring(xml_declaration=True, encoding='UTF-8')
|
||||
output_json = rss.tojson()
|
||||
output_json_indented = rss.tojson(indent=4)
|
||||
output_csv = rss.tocsv()
|
||||
```
|
||||
|
||||
##Cache information
|
||||
|
||||
|
|
Loading…
Reference in New Issue