Add CLI argument for selecting banks
All checks were successful
dustin/xactfetch/pipeline/head This commit looks good
All checks were successful
dustin/xactfetch/pipeline/head This commit looks good
When debugging a failure for one bank's website, I often want to run the fetch for just that bank. To date, I've been commenting out the other bank, but that is silly. Now, `xactfetch` can target a subset of banks by specifying their name slug(s) as CLI arguments.
This commit is contained in:
12
xactfetch.py
12
xactfetch.py
@@ -6,6 +6,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -690,10 +691,13 @@ def main() -> None:
|
|||||||
browser = pw.firefox.launch(headless=headless)
|
browser = pw.firefox.launch(headless=headless)
|
||||||
page = browser.new_page()
|
page = browser.new_page()
|
||||||
failed = False
|
failed = False
|
||||||
if not download_commerce(page, end_date, token, importer):
|
banks = sys.argv[1:] or list(ACCOUNTS.keys())
|
||||||
failed = True
|
if 'commerce' in banks:
|
||||||
if not download_chase(page, end_date, token, importer):
|
if not download_commerce(page, end_date, token, importer):
|
||||||
failed = True
|
failed = True
|
||||||
|
if 'chase' in banks:
|
||||||
|
if not download_chase(page, end_date, token, importer):
|
||||||
|
failed = True
|
||||||
raise SystemExit(1 if failed else 0)
|
raise SystemExit(1 if failed else 0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user