From 3aea7cb8da3d56e29ce642755545f65907697300 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 24 May 2014 19:03:05 +0200 Subject: [PATCH] Further document lib usage --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2852dd8..5c60501 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,28 @@ For example: `python2.7 PATH/TO/MORSS/morss.py http://feeds.bbci.co.uk/news/rss. ###As a python library -The code was not optimized to be used as a library. However here is a quick draft of what your code should look like if you intend to use morss as a library. This requires a lot of function calls, to have fine control over the different steps. +Quickly get a full-text feed: +```python +>>> import morss +>>> url = 'http://feeds.bbci.co.uk/news/rss.xml' +>>> cache = '/tmp/morss-cache' # cache folder, needs write permission +>>> xml_string = morss.process(url, cache) +>>> xml_string[:50] +"\n>> import morss +>>> url = 'http://feeds.bbci.co.uk/news/rss.xml' +>>> cache = '/tmp/morss-cache' +>>> options = ['csv', 'md'] +>>> xml_string = morss.process(url, cache, options) +>>> xml_string[:50] +'{"title": "BBC News - Home", "desc": "The latest s' +``` + +Doing it step-by-step: ```python import morss