Mercurial > roundup-cc
comparison examples/collect_demo3.py @ 20:3bb3d9a9f1b7
Filter by keywords and states.
Configuration via configuration file.
"No prio" grapf is displayed.
(./display_issues_demo.py is not yet dynamic, it needs all states)
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Mon, 22 Oct 2018 16:49:58 +0200 |
parents | |
children | 7a523e13fcb3 |
comparison
equal
deleted
inserted
replaced
19:8ffd584065a4 | 20:3bb3d9a9f1b7 |
---|---|
1 #!/usr/bin/env python3 | |
2 """Connect to roundup-tracker and save status to db for example demo1. | |
3 | |
4 Run periodically as often as you want data points to be saved. | |
5 demo1 only tracks issues with a priority. | |
6 """ | |
7 | |
8 import json | |
9 import configparser | |
10 from collect_issues import save_stats_in_db | |
11 import roundup_content_data as rcd | |
12 | |
13 COLUMNS = "critical, urgent, bug, feature, wish" | |
14 | |
15 config = configparser.ConfigParser() | |
16 config.read('config3.ini') | |
17 | |
18 base_url = config.get("URL", "BaseURL") | |
19 | |
20 user = config.get("LOGIN","Username") | |
21 password = config.get("LOGIN", "Password") | |
22 | |
23 LOGIN_PARAMETERS_DEMO = ( | |
24 ("__login_name", user), | |
25 ("__login_password", password), | |
26 ("@action", "Login"), | |
27 ) | |
28 | |
29 database_file = config.get("DB", "DatabaseFile") | |
30 | |
31 keywords = config.get("SEARCH", "Keywords", fallback="").split(", ") | |
32 | |
33 list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ") | |
34 | |
35 status = config.get("SEARCH", "Status", fallback="").split(", ") | |
36 | |
37 include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False) | |
38 | |
39 if include_no_prio: | |
40 list_of_columns += ["None"] | |
41 | |
42 select_all, select_where, create_db, insert_new = \ | |
43 rcd.build_sql_commands(list_of_columns) | |
44 | |
45 save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file, | |
46 list_of_columns, create_db, insert_new, keywords, status) |