Mercurial > roundup-cc
comparison examples/collect_demo3.py @ 21:7a523e13fcb3
Argpars added for the configuration file.
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Tue, 23 Oct 2018 13:06:16 +0200 |
parents | 3bb3d9a9f1b7 |
children |
comparison
equal
deleted
inserted
replaced
20:3bb3d9a9f1b7 | 21:7a523e13fcb3 |
---|---|
5 demo1 only tracks issues with a priority. | 5 demo1 only tracks issues with a priority. |
6 """ | 6 """ |
7 | 7 |
8 import json | 8 import json |
9 import configparser | 9 import configparser |
10 import argparse | |
11 | |
10 from collect_issues import save_stats_in_db | 12 from collect_issues import save_stats_in_db |
11 import roundup_content_data as rcd | 13 import roundup_content_data as rcd |
12 | 14 |
13 COLUMNS = "critical, urgent, bug, feature, wish" | 15 COLUMNS = "critical, urgent, bug, feature, wish" |
14 | 16 |
17 parser = argparse.ArgumentParser() | |
18 parser.add_argument("config_file", type=str, metavar="[config file]") | |
19 args = parser.parse_args() | |
20 | |
15 config = configparser.ConfigParser() | 21 config = configparser.ConfigParser() |
16 config.read('config3.ini') | 22 config.read(args.config_file) |
17 | 23 |
18 base_url = config.get("URL", "BaseURL") | 24 base_url = config.get("URL", "BaseURL") |
19 | 25 |
20 user = config.get("LOGIN","Username") | 26 user = config.get("LOGIN","Username") |
21 password = config.get("LOGIN", "Password") | 27 password = config.get("LOGIN", "Password") |