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""" 

2@file 

3@brief Function which starts a server to grab and read blog post for a mobule 

4based on pyqcuikhelper design. It relies on module :epkg:`pyrsslocal`. 

5""" 

6 

7import os 

8 

9 

10def rss_update_run_server(dbfile=None, xml_blogs=None, port=8093, browser=None, 

11 period="week", server=None, thread=False): # pragma: no cover 

12 """ 

13 Creates a database if it does not exists, add a table for blogs and posts, 

14 update the database, starts a server and open a browser, 

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

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

17 the modules developped for these teachings. 

18 

19 @param dbfile (str) sqllite database to create, if None, 

20 the function creates a file in the current folder 

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

22 the function chooses the string ``__blog__`` of this module, 

23 it can be a file or a string 

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

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

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

27 @param server to set up your own server 

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

29 

30 Example:: 

31 

32 from ensae_teaching_cs.automation import rss_teachings_update_run_server 

33 rss_teachings_update_run_server(browser="firefox") 

34 """ 

35 from pyrsslocal import rss_update_run_server 

36 if xml_blogs is None: 

37 raise ValueError("xml_blogs cannot be None") 

38 if dbfile is None: 

39 dbfile = os.path.join(os.path.dirname(xml_blogs), "rss_blog_posts.db3") 

40 

41 return rss_update_run_server(dbfile=dbfile, xml_blogs=xml_blogs, port=port, browser=browser, 

42 period=period, server=server, thread=thread)