module rss.rss_helper
¶
Short summary¶
module pyrsslocal.rss.rss_helper
Various function to automate the collection of blog posts.
Functions¶
function |
truncated documentation |
---|---|
Parses a RSS stream. |
|
Merges many rss file or url. |
|
Downloads all posts from a list of blogs stored in a database by function |
|
Parses a list of blogs stored in a XML file using Google Reader format, stores the results in a :epkg:`SQLite` … |
|
Starts a server and open a browser on a page reading blog posts. |
|
Creates a database if it does not exists, add a table for blogs and posts, update the database, starts a server … |
|
Produces a HTML. |
|
Converts something into RSS. |
Documentation¶
Various function to automate the collection of blog posts.
- pyrsslocal.rss.rss_helper.enumerate_rss_merge(rss_urls, title='compilation', min_size=None)¶
Merges many rss file or url.
- Parameters:
rss_urls – rss files or urls
title – title
min_size – fails if the downloaded file is below this size
- Returns:
new RSS
- pyrsslocal.rss.rss_helper.rss_download_post_to_database(database='database_rss.db3', table_blog='blogs', table_post='posts', fLOG=None)¶
Downloads all posts from a list of blogs stored in a database by function
rss_from_xml_to_database
.- Parameters:
database – database file name (SQLite format)
table_blog – table name of the blogs
table_post – table name of the post
fLOG – logging function
- Returns:
number of posts downloaded
- pyrsslocal.rss.rss_helper.rss_from_xml_to_database(file, database='database_rss.db3', table='blogs', fLOG=None)¶
Parses a list of blogs stored in a XML file using Google Reader format, stores the results in a :epkg:`SQLite` database.
- Parameters:
file – (str) xml file containing the list of blogs, example:
database – database file (sqlite)
table – table name
fLOG – logging function
- Returns:
number of stored blogs
The XML file should contain the following:
<outline text="XD blog" title="XD blog" type="rss" xmlUrl="http://www.xavierdupre.fr/blog/xdbrss.xml" htmlUrl="http://www.xavierdupre.fr/blog/xd_blog.html" />
The function does not check whether or not the blogs were already added to the database, they will be added a second time. If the table does not exist, it will be created.
- pyrsslocal.rss.rss_helper.rss_run_server(dbfile, port=8093, browser=None, period='today', server=None, thread=False, fLOG=None)¶
Starts a server and open a browser on a page reading blog posts.
- Parameters:
dbfile – (str) sqllite database to create
port – the main page will be
http://localhost:port/
browser – (str) to choose a different browser than the default one
period – (str) when opening the browser, it can show the results for last day or last week
server – to set up your own server
thread – to start the server in a separate thread
fLOG – logging function
You can read the blog post RSS Reader.
If browser is “none”, the browser is not started.
- pyrsslocal.rss.rss_helper.rss_update_run_server(dbfile, xml_blogs, port=8093, browser=None, period='today', server=None, thread=False, fLOG=None)¶
Creates a database if it does not exists, add a table for blogs and posts, update the database, starts a server and open a browser.
- Parameters:
dbfile – (str) sqllite database to create
xml_blogs – (str) xml description of blogs (google format) (file or string)
port – the main page will be
http://localhost:port/
browser – (str) to choose a different browser than the default one
period – (str) when opening the browser, it can show the results for last day or last week
server – to set up your own server
thread – to start the server in a separate thread
fLOG – logging function
- Returns:
see
rss_run_server
You can read the blog post pyhome3 RSS Reader.
- pyrsslocal.rss.rss_helper.to_html(items, template=None, title='BLOG', author='AUTHOR', keywords='blog,python', header='', rssfile='rssfile.xml', **context)¶
Produces a HTML.
- Parameters:
items – list of blog post
template – template or None to get the default one
title – blog title
author – author
keywords – keywords
header – blog description
rssfile – file RSS
context – other information
- Returns:
pages