xactfetch: Run xactfetch in a CronJob

I finally got *xactfetch* cleaned up enough to run in a headless
container.
This commit is contained in:
2023-12-23 07:08:41 -06:00
parent a235fbd5ac
commit 9561c687aa
7 changed files with 195 additions and 0 deletions

47
xactfetch/README.md Normal file
View File

@@ -0,0 +1,47 @@
# xactfetch—Automatically Import Bank Transactions
*xactfetch* is a tool that automates importing bank account transactions into
[Firefly-III] using CSV exports from banks' websites. It uses [Playwright] to
automate navigating the online banking portals and downloads transaction
exports, then imports the data using the [Firefly-III Data Importer].
## Online Banking Passwords
Credentials for online banking websites are stored in a Bitwarden Vault.
*xactfetch* uses a dedicated account for accessing Bitwarden, which is a member
of a special Organization that shares the bank credentials. My normal user is
also a member of this Organization, which allows me to use and update the
credentials normally, and any changes will automatically be made available to
*xactfetch*.
## Chase SMS Verification
The Chase website requires "verification" on a per-device basis. The first
time accessing the Chase website, a verification code will be sent to the SMS
number associated with the Chase account. That code must be provided in order
to log in. *xactfetch* does NOT automate this process. Instead, it tries to
appear like a device that has used the Chase website before by keeping a
persistent cookie store across executions.
Sometimes, the cookie that indicates the device has been verified expires or
otherwise becomes invalid. To fix this, *xactfetch* must be run manually with
a non-headless browser:
```sh
DEBUG_HEADLESS_BROWSER=0 python xactfetch.py
```
When the verification form is presented, follow the process to enter the code.
After *xactfetch* has completed successfully, copy the `cookies.json` file it
created to the Kubernetes PersistentVolume. One way to do this is to create
a Pod with the volume mounted, then use `kubectl` to copy the file:
```sh
kubectl exec -i -n firefly-iii xactfetch-28388926-5r778 -- sh -c 'cat > /var/lib/xactfetch/cookies.json' < cookies.json
```
[Firefly-III]: https://www.firefly-iii.org/
[Playwright]: https://playwright.dev/python/docs/intro
[Firefly-III Data Import Tool]: https://github.com/firefly-iii/data-importer/