module homeblog.buildrss#

Short summary#

module ensae_teaching_cs.homeblog.buildrss

About RSS

source on GitHub

Functions#

function

truncated documentation

check_encoding

check the encoding of a file (ASCII here), read the file, it does not return anything

file_build_rss

Build a RSS file, the function keeps the blog post (HTML format) from the last month. If a post contains one the two …

Documentation#

About RSS

source on GitHub

ensae_teaching_cs.homeblog.buildrss.check_encoding(file)#

check the encoding of a file (ASCII here), read the file, it does not return anything

Paramètres:

file – file to check

source on GitHub

ensae_teaching_cs.homeblog.buildrss.file_build_rss(folder='.', outfile='blog/xdbrss.xml', now=datetime.datetime(2023, 4, 28, 8, 44, 20, 189525), model_feed='<rss version="2.0">\n<channel>\n    <title>XD blog</title>\n    <link>http://www.xavierdupre.fr/blog/xd_blog_nojs.html</link>\n    <description>new posts from XD blog</description>\n    ', model_row='\n        <item>\n            <title>%s</title>\n            <link>http://www.xavierdupre.fr/blog/%s_nojs.html</link>\n            <guid isPermaLink="true">http://www.xavierdupre.fr/blog/%s_nojs.html</guid>\n            <description>%s</description>\n            <pubDate>%s</pubDate>\n        </item>', model_channel='\n</channel>\n</rss>\n', months_delay=6)#

Build a RSS file, the function keeps the blog post (HTML format) from the last month. If a post contains one the two following string:

<!-- SUMMARY BEGINS -->
<!-- SUMMARY ENDS -->

The summary will only contains the part included in those two comments.

Paramètres:
  • folder – folder where the blog post can be found

  • outfile – final file to produce

  • now – date to use as a final date, only blog post between one month now and now will be kept

  • model_feed – see model_channel

  • model_row – see model_row

  • model_channel

    the part related to a post in the rss stream is composed by the concatenation of the three stream:

    model_feed
    model_row
    model_channel
    

    You should see the default value to see how you can replace them.

  • months_delay – keep mails written a couple of months ago: month_delay months

Renvoie:

2-uple: outfile and the list of kept blog post (the last month)

source on GitHub