Mercurial > roundup-cc
view examples/collect_demo3.py @ 22:33d7c7769155
Fix typos in TODO.creole (minor)
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 02 Nov 2018 10:38:21 +0100 |
parents | 7a523e13fcb3 |
children |
line wrap: on
line source
#!/usr/bin/env python3 """Connect to roundup-tracker and save status to db for example demo1. Run periodically as often as you want data points to be saved. demo1 only tracks issues with a priority. """ import json import configparser import argparse from collect_issues import save_stats_in_db import roundup_content_data as rcd COLUMNS = "critical, urgent, bug, feature, wish" parser = argparse.ArgumentParser() parser.add_argument("config_file", type=str, metavar="[config file]") args = parser.parse_args() config = configparser.ConfigParser() config.read(args.config_file) base_url = config.get("URL", "BaseURL") user = config.get("LOGIN","Username") password = config.get("LOGIN", "Password") LOGIN_PARAMETERS_DEMO = ( ("__login_name", user), ("__login_password", password), ("@action", "Login"), ) database_file = config.get("DB", "DatabaseFile") keywords = config.get("SEARCH", "Keywords", fallback="").split(", ") list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ") status = config.get("SEARCH", "Status", fallback="").split(", ") include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False) if include_no_prio: list_of_columns += ["None"] select_all, select_where, create_db, insert_new = \ rcd.build_sql_commands(list_of_columns) save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file, list_of_columns, create_db, insert_new, keywords, status)