... | ... |
@@ -1,24 +1,24 @@ |
1 |
-# Boobank-utils |
|
2 |
-A set of utilities around Boobank. [Boobank][1] is a console application able |
|
1 |
+# Woobank-utils |
|
2 |
+A set of utilities around `woob bank`. [woob bank][1] is a console application able |
|
3 | 3 |
to list your bank accounts balances on supported websites and to see the |
4 | 4 |
expenses details, transfer money, etc. |
5 | 5 |
|
6 | 6 |
## Why? |
7 |
-boobank-graphite was written to replace [boobank-munin][2] as part of a |
|
7 |
+woobank-graphite was written to replace [boobank-munin][2] as part of a |
|
8 | 8 |
Munin-to-Graphite migration. |
9 | 9 |
|
10 |
-boobank-cacher was inspired by boobank-munin's cache mechanism and serves the |
|
10 |
+woobank-cacher was inspired by boobank-munin's cache mechanism and serves the |
|
11 | 11 |
exact same purpose: limiting the amount of connections to bank websites. |
12 | 12 |
|
13 |
-boobank-accounts and boobank-history allow end users to check out their |
|
13 |
+woobank-accounts and woobank-history allow end users to check out their |
|
14 | 14 |
accounts from cached files instead of establishing new connections to their |
15 | 15 |
bank websites. |
16 | 16 |
|
17 | 17 |
## Limitations and known bugs |
18 | 18 |
|
19 |
- - boobank-graphite does not send any tags; |
|
20 |
- - boobank-accounts completely ignores "coming" operations; |
|
21 |
- - boobank-accounts does not handle multiple currencies very well, especially when computing _the_ total. |
|
19 |
+ - woobank-graphite does not send any tags; |
|
20 |
+ - woobank-accounts completely ignores "coming" operations; |
|
21 |
+ - woobank-accounts does not handle multiple currencies very well, especially when computing _the_ total. |
|
22 | 22 |
|
23 | 23 |
## Description of utilities |
24 | 24 |
### Common behaviour |
... | ... |
@@ -27,31 +27,31 @@ Most utilities provided by this project will: |
27 | 27 |
- consider `-` as a filepath meaning "use standard input" |
28 | 28 |
- default to standard input if no input file are provided |
29 | 29 |
|
30 |
-### boobank-cacher |
|
31 |
-Run 1 to n boobank commands and save their JSON output to file, along with a timestamp. boobank-cacher also handles "additions", i.e. the ability to insert simple, static data in the JSON output. |
|
30 |
+### woobank-cacher |
|
31 |
+Run 1 to n `woob bank` commands and save their JSON output to file, along with a timestamp. woobank-cacher also handles "additions", i.e. the ability to insert simple, static data in the JSON output. |
|
32 | 32 |
|
33 |
-Usage: ``boobank-cacher [-h] [-c CONFIG]`` |
|
33 |
+Usage: ``woobank-cacher [-h] [-c CONFIG]`` |
|
34 | 34 |
|
35 |
-`CONFIG` defaults to `~/.config/boobank-utils/cacher.json`. See the conf subdirectory for a sample configuration file. |
|
35 |
+`CONFIG` defaults to `~/.config/woobank-utils/cacher.json`. See the conf subdirectory for a sample configuration file. |
|
36 | 36 |
|
37 |
-### boobank-graphite |
|
38 |
-Take a JSON file created by the "boobank list" command and send it to a Graphite instance. |
|
37 |
+### woobank-graphite |
|
38 |
+Take a JSON file created by the "woob bank list" command and send it to a Graphite instance. |
|
39 | 39 |
|
40 |
-Usage: ``boobank-graphite [-h] [-gh HOST] [-gp PORT] [json_file]`` |
|
40 |
+Usage: ``woobank-graphite [-h] [-gh HOST] [-gp PORT] [json_file]`` |
|
41 | 41 |
|
42 |
-### boobank-accounts |
|
43 |
-Take a JSON file created by the "boobank list" command and display its contents in your terminal. |
|
42 |
+### woobank-accounts |
|
43 |
+Take a JSON file created by the "woob bank list" command and display its contents in your terminal. |
|
44 | 44 |
|
45 |
-Usage: ``boobank-accounts [-h] [json_file [json_file ...]]`` |
|
45 |
+Usage: ``woobank-accounts [-h] [json_file [json_file ...]]`` |
|
46 | 46 |
|
47 |
-### boobank-history |
|
48 |
-Take a JSON file created by the "boobank history" command and display its contents in your terminal. |
|
47 |
+### woobank-history |
|
48 |
+Take a JSON file created by the "woob bank history" command and display its contents in your terminal. |
|
49 | 49 |
|
50 |
-Usage: ``boobank-history [-h] [-c COUNT] [json_file]`` |
|
50 |
+Usage: ``woobank-history [-h] [-c COUNT] [json_file]`` |
|
51 | 51 |
|
52 | 52 |
## License |
53 | 53 |
This project is licensed under [WTFPL][3]. |
54 | 54 |
|
55 |
-[1]: http://weboob.org/applications/boobank |
|
56 |
-[2]: https://git.weboob.org/weboob/devel/blob/master/contrib/munin/boobank-munin |
|
55 |
+[1]: https://woob.tech/applications/bank |
|
56 |
+[2]: https://gitlab.com/woob/woob/-/blob/master/contrib/munin/boobank-munin |
|
57 | 57 |
[3]: http://www.wtfpl.net/ |
58 | 58 |
similarity index 83% |
59 | 59 |
rename from bin/boobank-accounts |
60 | 60 |
rename to bin/woobank-accounts |
... | ... |
@@ -1,26 +1,26 @@ |
1 | 1 |
#!/usr/bin/env python3 |
2 | 2 |
# -*- coding: utf-8 -*- |
3 |
-# Copyright © 2017-2019 Xavier G. <xavier.boobank@kindwolf.org> |
|
3 |
+# Copyright © 2017-2022 Xavier G. <xavier.woobank@kindwolf.org> |
|
4 | 4 |
# This work is free. You can redistribute it and/or modify it under the |
5 | 5 |
# terms of the Do What The Fuck You Want To Public License, Version 2, |
6 | 6 |
# as published by Sam Hocevar. See the COPYING file for more details. |
7 | 7 |
""" |
8 |
-boobank-accounts takes one or several JSON files, as created by boobank-cacher |
|
9 |
-when running and caching a "boobank list" command, and display their contents. |
|
8 |
+woobank-accounts takes one or several JSON files, as created by woobank-cacher |
|
9 |
+when running and caching a "woob bank list" command, and display their contents. |
|
10 | 10 |
""" |
11 | 11 |
|
12 | 12 |
import time |
13 | 13 |
import argparse |
14 | 14 |
from prettytable import PrettyTable |
15 | 15 |
from termcolor import colored |
16 |
-from boobank_utils import format_amount, format_timestamp_colored, load_json |
|
17 |
-from boobank_utils import DEFAULT_CURRENCY, COLORING_THRESHOLD, MAX_AGE |
|
16 |
+from woobank_utils import format_amount, format_timestamp_colored, load_json |
|
17 |
+from woobank_utils import DEFAULT_CURRENCY, COLORING_THRESHOLD, MAX_AGE |
|
18 | 18 |
|
19 | 19 |
def parse_args(): |
20 | 20 |
""" |
21 | 21 |
Parse command-line arguments. |
22 | 22 |
""" |
23 |
- description = 'Display the contents of cached "boobank list" JSON files.' |
|
23 |
+ description = 'Display the contents of cached "woob bank list" JSON files.' |
|
24 | 24 |
args_parser = argparse.ArgumentParser(description=description) |
25 | 25 |
args_parser.add_argument('json_file', nargs='*', default=['-'], help='JSON files to display') |
26 | 26 |
return args_parser.parse_args() |
27 | 27 |
similarity index 74% |
28 | 28 |
rename from bin/boobank-cacher |
29 | 29 |
rename to bin/woobank-cacher |
... | ... |
@@ -1,11 +1,11 @@ |
1 | 1 |
#!/usr/bin/env python3 |
2 | 2 |
# -*- coding: utf-8 -*- |
3 |
-# Copyright © 2017-2019 Xavier G. <xavier.boobank@kindwolf.org> |
|
3 |
+# Copyright © 2017-2022 Xavier G. <xavier.woobank@kindwolf.org> |
|
4 | 4 |
# This work is free. You can redistribute it and/or modify it under the |
5 | 5 |
# terms of the Do What The Fuck You Want To Public License, Version 2, |
6 | 6 |
# as published by Sam Hocevar. See the COPYING file for more details. |
7 | 7 |
""" |
8 |
-boobank-cacher runs a list of boobank commands defined in its configuration |
|
8 |
+woobank-cacher runs a list of "woob bank" commands defined in its configuration |
|
9 | 9 |
file. For each command, it has the ability to inject simple, additional data to |
10 | 10 |
the result before saving it to a JSON file. |
11 | 11 |
That JSON file can then act as a local cache, which other tools can leverage |
... | ... |
@@ -19,45 +19,45 @@ import copy |
19 | 19 |
import time |
20 | 20 |
import argparse |
21 | 21 |
import subprocess |
22 |
-from boobank_utils import mkdir, DEFAULT_CONF_DIR |
|
22 |
+from woobank_utils import mkdir, DEFAULT_CONF_DIR |
|
23 | 23 |
|
24 | 24 |
def get_conf(conf_path): |
25 | 25 |
""" |
26 |
- Return the contents of the boobank-cacher configuration. |
|
26 |
+ Return the contents of the woobank-cacher configuration. |
|
27 | 27 |
""" |
28 | 28 |
conf_path = os.path.expanduser(conf_path) |
29 | 29 |
with open(conf_path, 'r') as filedesc: |
30 | 30 |
return json.load(filedesc) |
31 | 31 |
|
32 |
-def run_boobank(conf): |
|
32 |
+def run_woob_bank(conf): |
|
33 | 33 |
""" |
34 |
- Pipe the commands found in the given boobank-cacher configuration to a |
|
35 |
- single boobank process and return their results. |
|
34 |
+ Pipe the commands found in the given woobank-cacher configuration to a |
|
35 |
+ single "woob bank" process and return their results. |
|
36 | 36 |
""" |
37 | 37 |
results = copy.deepcopy(conf) |
38 | 38 |
# Ensure there is at least one command to run: |
39 | 39 |
commands = results.get('commands', []) |
40 | 40 |
if not commands: |
41 | 41 |
return results |
42 |
- boobank_path = os.path.expanduser(conf.get('boobank_path', 'boobank')) |
|
43 |
- boobank_command = [boobank_path, '--formatter=json'] |
|
44 |
- boobank_process = subprocess.Popen(boobank_command, stdin=subprocess.PIPE, |
|
42 |
+ woob_path = os.path.expanduser(conf.get('woob_path', 'woob')) |
|
43 |
+ woob_bank_command = [woob_path, 'bank', '--formatter=json'] |
|
44 |
+ woob_bank_process = subprocess.Popen(woob_bank_command, stdin=subprocess.PIPE, |
|
45 | 45 |
stdout=subprocess.PIPE, close_fds=True, bufsize=-1) |
46 | 46 |
# Send all commands at once: |
47 | 47 |
for command in commands: |
48 | 48 |
command_line = command['command'] + "\n" |
49 |
- boobank_process.stdin.write(command_line.encode('utf-8')) |
|
50 |
- boobank_process.stdin.write("quit\n".encode('utf-8')) |
|
51 |
- boobank_process.stdin.flush() |
|
52 |
- boobank_process.stdin.close() |
|
49 |
+ woob_bank_process.stdin.write(command_line.encode('utf-8')) |
|
50 |
+ woob_bank_process.stdin.write("quit\n".encode('utf-8')) |
|
51 |
+ woob_bank_process.stdin.flush() |
|
52 |
+ woob_bank_process.stdin.close() |
|
53 | 53 |
# Parse output to extract relevant lines only: |
54 | 54 |
out_time = time.time() |
55 | 55 |
out_lines = [] |
56 | 56 |
while True: |
57 |
- out_line = boobank_process.stdout.readline().decode('utf-8') |
|
57 |
+ out_line = woob_bank_process.stdout.readline().decode('utf-8') |
|
58 | 58 |
if not out_line: |
59 | 59 |
break |
60 |
- rem = re.search(r'^boobank>\s*(.+)$', out_line) |
|
60 |
+ rem = re.search(r'^bank>\s*(.+)$', out_line) |
|
61 | 61 |
if rem: |
62 | 62 |
out_lines.append(rem.group(1)) |
63 | 63 |
for i in range(len(commands)): |
... | ... |
@@ -67,7 +67,7 @@ def run_boobank(conf): |
67 | 67 |
|
68 | 68 |
def process_additions(results): |
69 | 69 |
""" |
70 |
- Inject additional data described in the boobank-cacher configuration to the |
|
70 |
+ Inject additional data described in the woobank-cacher configuration to the |
|
71 | 71 |
given results. |
72 | 72 |
""" |
73 | 73 |
for command in results.get('commands', []): |
... | ... |
@@ -87,7 +87,7 @@ def process_additions(results): |
87 | 87 |
|
88 | 88 |
def write_cache(results): |
89 | 89 |
""" |
90 |
- Write the given results to cache files as described in the boobank-cacher |
|
90 |
+ Write the given results to cache files as described in the woobank-cacher |
|
91 | 91 |
configuration. |
92 | 92 |
""" |
93 | 93 |
for command in results.get('commands', []): |
... | ... |
@@ -105,7 +105,7 @@ def parse_args(): |
105 | 105 |
""" |
106 | 106 |
Parse command-line arguments. |
107 | 107 |
""" |
108 |
- description = 'Cache the output of boobank commands to JSON files.' |
|
108 |
+ description = 'Cache the output of woob bank commands to JSON files.' |
|
109 | 109 |
args_parser = argparse.ArgumentParser(description=description) |
110 | 110 |
default_conf = os.path.join(DEFAULT_CONF_DIR, 'cacher.json') |
111 | 111 |
args_parser.add_argument('-c', '--config', default=default_conf, |
... | ... |
@@ -118,7 +118,7 @@ def main(): |
118 | 118 |
""" |
119 | 119 |
args = parse_args() |
120 | 120 |
conf = get_conf(args.config) |
121 |
- results = run_boobank(conf) |
|
121 |
+ results = run_woob_bank(conf) |
|
122 | 122 |
process_additions(results) |
123 | 123 |
write_cache(results) |
124 | 124 |
|
125 | 125 |
similarity index 88% |
126 | 126 |
rename from bin/boobank-graphite |
127 | 127 |
rename to bin/woobank-graphite |
... | ... |
@@ -1,12 +1,12 @@ |
1 | 1 |
#!/usr/bin/env python3 |
2 | 2 |
# -*- coding: utf-8 -*- |
3 |
-# Copyright © 2017-2019 Xavier G. <xavier.boobank@kindwolf.org> |
|
3 |
+# Copyright © 2017-2022 Xavier G. <xavier.woobank@kindwolf.org> |
|
4 | 4 |
# This work is free. You can redistribute it and/or modify it under the |
5 | 5 |
# terms of the Do What The Fuck You Want To Public License, Version 2, |
6 | 6 |
# as published by Sam Hocevar. See the COPYING file for more details. |
7 | 7 |
""" |
8 |
-boobank-graphite takes a JSON file, as created by boobank-cacher when running |
|
9 |
-and caching a "boobank list" command, and sends it to a Graphite instance. |
|
8 |
+woobank-graphite takes a JSON file, as created by woobank-cacher when running |
|
9 |
+and caching a "woob bank list" command, and sends it to a Graphite instance. |
|
10 | 10 |
""" |
11 | 11 |
|
12 | 12 |
import sys |
... | ... |
@@ -14,7 +14,7 @@ import json |
14 | 14 |
import time |
15 | 15 |
import socket |
16 | 16 |
import argparse |
17 |
-from boobank_utils import DEFAULT_CURRENCY |
|
17 |
+from woobank_utils import DEFAULT_CURRENCY |
|
18 | 18 |
|
19 | 19 |
|
20 | 20 |
def main(): |
... | ... |
@@ -33,7 +33,7 @@ def parse_args(): |
33 | 33 |
""" |
34 | 34 |
Parse command-line arguments. |
35 | 35 |
""" |
36 |
- description = 'Send the contents of a boobank-cacher JSON file to Graphite.' |
|
36 |
+ description = 'Send the contents of a woobank-cacher JSON file to Graphite.' |
|
37 | 37 |
args = argparse.ArgumentParser(description=description) |
38 | 38 |
args.add_argument('-gh', '--graphite-host', dest='host', default='::1', |
39 | 39 |
help='Graphite host; defaults to ::1.') |
40 | 40 |
similarity index 84% |
41 | 41 |
rename from bin/boobank-history |
42 | 42 |
rename to bin/woobank-history |
... | ... |
@@ -1,26 +1,26 @@ |
1 | 1 |
#!/usr/bin/env python3 |
2 | 2 |
# -*- coding: utf-8 -*- |
3 |
-# Copyright © 2017-2019 Xavier G. <xavier.boobank@kindwolf.org> |
|
3 |
+# Copyright © 2017-2022 Xavier G. <xavier.woobank@kindwolf.org> |
|
4 | 4 |
# This work is free. You can redistribute it and/or modify it under the |
5 | 5 |
# terms of the Do What The Fuck You Want To Public License, Version 2, |
6 | 6 |
# as published by Sam Hocevar. See the COPYING file for more details. |
7 | 7 |
""" |
8 |
-boobank-history takes a JSON file, as created by boobank-cacher when running |
|
9 |
-and caching a "boobank history" command, and display its contents. |
|
8 |
+woobank-history takes a JSON file, as created by woobank-cacher when running |
|
9 |
+and caching a "woob bank history" command, and display its contents. |
|
10 | 10 |
""" |
11 | 11 |
|
12 | 12 |
import time |
13 | 13 |
import argparse |
14 | 14 |
from prettytable import PrettyTable |
15 | 15 |
from termcolor import colored |
16 |
-from boobank_utils import format_amount, load_json, format_timestamp_colored |
|
17 |
-from boobank_utils import MAX_AGE, DEFAULT_CURRENCY, COLORING_SIMPLE |
|
16 |
+from woobank_utils import format_amount, load_json, format_timestamp_colored |
|
17 |
+from woobank_utils import MAX_AGE, DEFAULT_CURRENCY, COLORING_SIMPLE |
|
18 | 18 |
|
19 | 19 |
def parse_args(): |
20 | 20 |
""" |
21 | 21 |
Parse command-line arguments. |
22 | 22 |
""" |
23 |
- description = 'Display the contents of a cached "boobank history" JSON file.' |
|
23 |
+ description = 'Display the contents of a cached "woob bank history" JSON file.' |
|
24 | 24 |
args_parser = argparse.ArgumentParser(description=description) |
25 | 25 |
args_parser.add_argument('json_file', nargs='?', default='-', help='JSON file to display') |
26 | 26 |
args_parser.add_argument('-c', '--count', default=None, type=int, |
27 | 27 |
similarity index 95% |
28 | 28 |
rename from bin/boobank_utils.py |
29 | 29 |
rename to bin/woobank_utils.py |
... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
# -*- coding: utf-8 -*- |
2 |
-# Copyright © 2017-2019 Xavier G. <xavier.boobank@kindwolf.org> |
|
2 |
+# Copyright © 2017-2022 Xavier G. <xavier.woobank@kindwolf.org> |
|
3 | 3 |
# This work is free. You can redistribute it and/or modify it under the |
4 | 4 |
# terms of the Do What The Fuck You Want To Public License, Version 2, |
5 | 5 |
# as published by Sam Hocevar. See the COPYING file for more details. |
6 | 6 |
""" |
7 |
-This module provides various functions and constants used by the boobank-utils |
|
7 |
+This module provides various functions and constants used by the woobank-utils |
|
8 | 8 |
tools. |
9 | 9 |
""" |
10 | 10 |
import os |
... | ... |
@@ -14,7 +14,7 @@ import json |
14 | 14 |
import errno |
15 | 15 |
from termcolor import colored |
16 | 16 |
|
17 |
-DEFAULT_CONF_DIR = '~/.config/boobank-utils' |
|
17 |
+DEFAULT_CONF_DIR = '~/.config/woobank-utils' |
|
18 | 18 |
MAX_AGE = 24 * 60 * 60 |
19 | 19 |
|
20 | 20 |
UNUSUAL_THRESHOLD = 500.0 |
21 | 21 |
similarity index 74% |
22 | 22 |
rename from conf/boobank-utils/cacher.json |
23 | 23 |
rename to conf/woobank-utils/cacher.json |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
{ |
2 |
- "boobank_path": "boobank", |
|
2 |
+ "woob_path": "woob", |
|
3 | 3 |
"commands": [ |
4 | 4 |
{ |
5 | 5 |
"command": "list", |
6 |
- "cache_path": "~/.cache/boobank-cacher/list.json", |
|
6 |
+ "cache_path": "~/.cache/woobank-cacher/list.json", |
|
7 | 7 |
"additions": { |
8 | 8 |
"accountid@bank": { |
9 | 9 |
"id": "", |
... | ... |
@@ -17,7 +17,7 @@ |
17 | 17 |
"command": "count 50" |
18 | 18 |
}, |
19 | 19 |
{ |
20 |
- "cache_path": "~/.cache/boobank-cacher/history.json", |
|
20 |
+ "cache_path": "~/.cache/woobank-cacher/history.json", |
|
21 | 21 |
"command": "history current-account-id@yourbank" |
22 | 22 |
} |
23 | 23 |
] |