view doc/collect_demo3.py @ 36:59e1659a0a0b tip

Update 'TODO.creole' * Old TODOs moved to 'doc/old_TODO.creole'
author Magnus Schieder <mschieder@intevation.de>
date Mon, 26 Nov 2018 16:52:45 +0100
parents 916fa83b4144
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)