Mercurial > roundup-cc
annotate examples/collect_demo1.py @ 17:adca5b3780d2
Add collecting no-prio issues. Restructure.
* Move usage examples from collect_issues.py to examples/.
Also add a section about this to the readme. This should
make it easier to understand how it all works together.
As we have two examples now, hardcode the database filenames.
* Add a function to create the necessary database command from a list
of columns. This makes it easier to work with tracker that have
customized their priorities,
* Add an example how to collect no-prio issues in a database.
Note that the display part is not included.
* Cleanup roundup_content_data by removing db file name suggestions
and unused "reference db" command. This could be re-added for specific
installations if they need it, however it probably should be separated
as configuration.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 09 Jul 2018 12:28:28 +0200 |
parents | |
children |
rev | line source |
---|---|
17
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
2 """Connect to roundup-tracker and save status to db for example demo1. |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
3 |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
4 Run periodically as often as you want data points to be saved. |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
5 demo1 only tracks issues with a priority. |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
6 """ |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
7 from collect_issues import save_stats_in_db |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
8 import roundup_content_data as rcd |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
9 |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
10 BASE_URL_DEMO = "http://localhost:8917/demo/" |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
11 SEARCH_URL_DEMO = "issue?@action=export_csv&@columns=title,priority&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,5,6,7" |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
12 |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
13 LOGIN_PARAMETERS_DEMO = ( |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
14 ("__login_name", "demo"), |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
15 ("__login_password", "demo"), |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
16 ("@action", "Login"), |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
17 ) |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
18 |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
19 save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo1.py", |
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
20 rcd.COLUMNS, rcd.CREATE_DB, rcd.INSERT_NEW, SEARCH_URL_DEMO) |