Files
actual-scripts/actual_bank_sync.py

31 lines
951 B
Python

from actual import Actual
import os
from dotenv import load_dotenv
load_dotenv()
def main():
synced_accounts = os.getenv('SYNCED_ACCOUNTS')
with Actual(
base_url=os.getenv('BASEURL'),
password=os.getenv('PASSWORD'),
encryption_password=None, # Optional: Password for the file encryption. Will not use it if set to None.
file=os.getenv('FILE'),
cert=False
) as actual:
for account in synced_accounts:
try:
sync_test = actual.run_bank_sync(account=account, run_rules=True)
except Exception as e:
print("**************")
print(f"An exception occurred! \n {e}")
print("**************")
else:
for transaction in sync_test:
print(f"Added of modified {transaction}")
finally:
actual.commit()
if __name__ == "__main__":
main()