I read the documentation, but it's not immediately clear to me what to do.
I have put together the following code from the examples. In reality, a TAN is only required for the transactions, not for the balance, so the first TAN query never executes. I want to achieve that I have to enter a TAN only every couple of months like how it works for my banking app, but I can't understand from the documentation how to save the state.
It's probably just a minor mistake. Please help.
defkontostand(failOnError=False):
blz="***"login="***"key_id=f"{blz}.{login}"password=keyring.get_password("fints", key_id)
ifnotpassword:
password=getpass.getpass("PIN:")
keyring.set_password("fints", key_id, password)
# Restore statetan_data=Noneifos.path.exists("tan.data"):
withopen("tan.data", "rb") asf:
tan_data=f.read()
client=FinTS3PinTanClient(
blz, # Your bank's BLZlogin, # Your login namepassword, # Your banking PIN"https://fints1.atruvia.de/cgi-bin/hbciservlet",
product_id="6151256F3D4F9975B877BD4A2", # https://community.home-assistant.io/t/fints-access-needs-product-id/322464/4from_data=tan_data,
)
minimal_interactive_cli_bootstrap(client)
withclient:
# Since PSD2, a TAN might be needed for dialog initialization.# Let's check if there is one requiredifclient.init_tan_response:
iffailOnError:
raiseException("A TAN is required. Run tan.py separately.")
else:
print("A TAN is required", client.init_tan_response.challenge)
tan=input("Please enter TAN:")
client.send_tan(client.init_tan_response, tan)
# Fetch accountsaccounts=client.get_sepa_accounts()
balance=client.get_balance(accounts[0])
transactions=client.get_transactions_xml(accounts[0])
ifisinstance(transactions, NeedTANResponse):
print("Eine TAN wird benötigt!")
print(transactions.challenge)
tan=input("TAN:")
transactions=client.send_tan(transactions, tan)
client_data=client.deconstruct()
# Save statewithopen("tan.data", "wb") asf:
f.write(client_data)
returnbalance.amount.amount, transactions
I read the documentation, but it's not immediately clear to me what to do.
I have put together the following code from the examples. In reality, a TAN is only required for the transactions, not for the balance, so the first TAN query never executes. I want to achieve that I have to enter a TAN only every couple of months like how it works for my banking app, but I can't understand from the documentation how to save the state.
It's probably just a minor mistake. Please help.