fix: get screenshot dir using config file
This commit is contained in:
parent
3df3d1059c
commit
c36030856d
4 changed files with 7 additions and 2 deletions
|
@ -39,7 +39,7 @@ class LclDownloader:
|
||||||
try:
|
try:
|
||||||
return self._download()
|
return self._download()
|
||||||
except Exception:
|
except Exception:
|
||||||
screenshot = Path(os.getenv("SCREENSHOT_DIR", default="/tmp")) / "error_download.png"
|
screenshot = Path(self.config.screenshot_dir) / "error_download_lcl.png"
|
||||||
self.selenium.save_screenshot(screenshot)
|
self.selenium.save_screenshot(screenshot)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ def get_default_config():
|
||||||
default_config["DEFAULT"] = {
|
default_config["DEFAULT"] = {
|
||||||
"token": "<YOUR API TOKEN>",
|
"token": "<YOUR API TOKEN>",
|
||||||
"budget": "<YOUR BUDGET ID>",
|
"budget": "<YOUR BUDGET ID>",
|
||||||
|
"screenshot_dir": "/tmp",
|
||||||
"mailgun_api_key": "",
|
"mailgun_api_key": "",
|
||||||
"mailgun_domain": "",
|
"mailgun_domain": "",
|
||||||
"mailgun_from": "",
|
"mailgun_from": "",
|
||||||
|
@ -76,6 +77,7 @@ class Config:
|
||||||
account: str
|
account: str
|
||||||
budget_id: str
|
budget_id: str
|
||||||
token: str
|
token: str
|
||||||
|
screenshot_dir: str
|
||||||
bank_identifier: Optional[str] = None
|
bank_identifier: Optional[str] = None
|
||||||
bank_password: Optional[str] = None
|
bank_password: Optional[str] = None
|
||||||
mailgun_api_key: Optional[str] = None
|
mailgun_api_key: Optional[str] = None
|
||||||
|
@ -152,6 +154,7 @@ def get_config(account: str) -> Config:
|
||||||
section = config[account]
|
section = config[account]
|
||||||
budget_id = section["budget"]
|
budget_id = section["budget"]
|
||||||
token = section["token"]
|
token = section["token"]
|
||||||
|
screenshot_dir = section.get("screenshot_dir")
|
||||||
if account == "DEFAULT":
|
if account == "DEFAULT":
|
||||||
ynab_account_id = ""
|
ynab_account_id = ""
|
||||||
else:
|
else:
|
||||||
|
@ -174,6 +177,7 @@ def get_config(account: str) -> Config:
|
||||||
ynab_account_id,
|
ynab_account_id,
|
||||||
budget_id,
|
budget_id,
|
||||||
token,
|
token,
|
||||||
|
screenshot_dir,
|
||||||
bank_identifier,
|
bank_identifier,
|
||||||
bank_password,
|
bank_password,
|
||||||
mailgun_api_key,
|
mailgun_api_key,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ofx-processor"
|
name = "ofx-processor"
|
||||||
version = "4.4.3"
|
version = "4.4.4"
|
||||||
description = "Personal ofx processor"
|
description = "Personal ofx processor"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Gabriel Augendre <gabriel@augendre.info>"]
|
authors = ["Gabriel Augendre <gabriel@augendre.info>"]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
token = <YOUR API TOKEN>
|
token = <YOUR API TOKEN>
|
||||||
budget = <YOUR BUDGET ID>
|
budget = <YOUR BUDGET ID>
|
||||||
|
screenshot_dir = /tmp
|
||||||
|
|
||||||
[bpvf]
|
[bpvf]
|
||||||
account = <YOUR BPVF ACCOUNT ID>
|
account = <YOUR BPVF ACCOUNT ID>
|
||||||
|
|
Loading…
Reference in a new issue