Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief Function to capture RSS stream from modules for this teachings. 

5""" 

6 

7import os 

8from pyrsslocal import rss_update_run_server 

9 

10 

11def rss_teachings_update_run_server(dbfile=None, xml_blogs=None, port=8093, browser=None, 

12 period="week", server=None, thread=False): 

13 """ 

14 Creates a database if it does not exists, adds a table for blogs and posts, 

15 updates the database, starts a server and open a browser, 

16 if *dbfile* is None, it is set to a default values (in your user directory), 

17 if *xml_blogs* is None, it is given a default value corresponding the the blogs 

18 the modules developped for these teachings. 

19 

20 @param dbfile (str) sqllite database to create 

21 @param xml_blogs (str) xml description of blogs (google format) 

22 @param port the main page will be ``http://localhost:port/`` 

23 @param browser (str) to choose a different browser than the default one 

24 @param period (str) when opening the browser, it can show the results for last day or last week 

25 @param server to set up your own server 

26 @param thread to start the server in a separate thread 

27 

28 Example:: 

29 

30 from ensae_teaching_cs.automation import rss_teachings_update_run_server 

31 rss_teachings_update_run_server(browser="firefox") 

32 """ 

33 if xml_blogs is None: 

34 raise ValueError("xml_blogs cannot be None") 

35 if dbfile is None: 

36 user = os.path.abspath(os.environ["HOMEPATH"]) 

37 dbfile = os.path.join(user, "ensae_teaching_cs_blogs.db3") 

38 if not os.path.exists(xml_blogs): 

39 raise FileNotFoundError(xml_blogs) 

40 return rss_update_run_server(dbfile=dbfile, xml_blogs=xml_blogs, port=port, browser=browser, period=period, 

41 server=server, thread=thread)