comparison doc/collect_demo3.py @ 34:916fa83b4144

Clean up repository. 'Update README.creole' * /doc added for the old demos. * Added comments to config.ini.
author Magnus Schieder <mschieder@intevation.de>
date Mon, 26 Nov 2018 16:08:27 +0100
parents examples/collect_demo3.py@7a523e13fcb3
children
comparison
equal deleted inserted replaced
33:946b9f458fcc 34:916fa83b4144
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 import argparse
11
12 from collect_issues import save_stats_in_db
13 import roundup_content_data as rcd
14
15 COLUMNS = "critical, urgent, bug, feature, wish"
16
17 parser = argparse.ArgumentParser()
18 parser.add_argument("config_file", type=str, metavar="[config file]")
19 args = parser.parse_args()
20
21 config = configparser.ConfigParser()
22 config.read(args.config_file)
23
24 base_url = config.get("URL", "BaseURL")
25
26 user = config.get("LOGIN","Username")
27 password = config.get("LOGIN", "Password")
28
29 LOGIN_PARAMETERS_DEMO = (
30 ("__login_name", user),
31 ("__login_password", password),
32 ("@action", "Login"),
33 )
34
35 database_file = config.get("DB", "DatabaseFile")
36
37 keywords = config.get("SEARCH", "Keywords", fallback="").split(", ")
38
39 list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ")
40
41 status = config.get("SEARCH", "Status", fallback="").split(", ")
42
43 include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False)
44
45 if include_no_prio:
46 list_of_columns += ["None"]
47
48 select_all, select_where, create_db, insert_new = \
49 rcd.build_sql_commands(list_of_columns)
50
51 save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file,
52 list_of_columns, create_db, insert_new, keywords, status)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)