mschieder@20: #!/usr/bin/env python3 mschieder@20: """Connect to roundup-tracker and save status to db for example demo1. mschieder@20: mschieder@20: Run periodically as often as you want data points to be saved. mschieder@20: demo1 only tracks issues with a priority. mschieder@20: """ mschieder@20: mschieder@20: import json mschieder@20: import configparser mschieder@20: from collect_issues import save_stats_in_db mschieder@20: import roundup_content_data as rcd mschieder@20: mschieder@20: COLUMNS = "critical, urgent, bug, feature, wish" mschieder@20: mschieder@20: config = configparser.ConfigParser() mschieder@20: config.read('config3.ini') mschieder@20: mschieder@20: base_url = config.get("URL", "BaseURL") mschieder@20: mschieder@20: user = config.get("LOGIN","Username") mschieder@20: password = config.get("LOGIN", "Password") mschieder@20: mschieder@20: LOGIN_PARAMETERS_DEMO = ( mschieder@20: ("__login_name", user), mschieder@20: ("__login_password", password), mschieder@20: ("@action", "Login"), mschieder@20: ) mschieder@20: mschieder@20: database_file = config.get("DB", "DatabaseFile") mschieder@20: mschieder@20: keywords = config.get("SEARCH", "Keywords", fallback="").split(", ") mschieder@20: mschieder@20: list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ") mschieder@20: mschieder@20: status = config.get("SEARCH", "Status", fallback="").split(", ") mschieder@20: mschieder@20: include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False) mschieder@20: mschieder@20: if include_no_prio: mschieder@20: list_of_columns += ["None"] mschieder@20: mschieder@20: select_all, select_where, create_db, insert_new = \ mschieder@20: rcd.build_sql_commands(list_of_columns) mschieder@20: mschieder@20: save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file, mschieder@20: list_of_columns, create_db, insert_new, keywords, status)