view examples/collect_demo3.py @ 29:8d86ba8dee42

Rename roundup_cc_display.py to display_issues.py and display_issues_demo.py to roundup_cc_display.py
author Magnus Schieder <mschieder@intevation.de>
date Thu, 22 Nov 2018 13:23:51 +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)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)