Skip to content

get_transactions() crashes with TypeError when CAMT fallback requires TAN #204

@krystofbe

Description

@krystofbe

Related to #200 - After upgrading to 5.0.0b1 to use CAMT fallback for GLS Bank, get_transactions() crashes when the bank requires TAN authentication during the CAMT request.

Describe the bug

The issue is in client.py line 541 in the CAMT fallback path:

except FinTSUnsupportedOperation:
    hkcaz = self._find_highest_supported_command(HKCAZ1)
    booked_streams, pending_streams = self._get_transactions_xml(...)  # ← crashes here

This tries to unpack the result as a tuple, but _get_transactions_xml() can return NeedTANResponse when TAN is required.

Bank I tested this with

Expected behavior

get_transactions() should return NeedTANResponse so the caller can handle it (same as the MT940 path does).

Error message

fints.exceptions.FinTSUnsupportedOperation: No supported HIKAZS version found. I support (5, 6, 7), bank supports ().

During handling of the above exception, another exception occurred:

TypeError: cannot unpack non-iterable NeedTANResponse object
  File "fints/client.py", line 541, in get_transactions
    booked_streams, pending_streams = self._get_transactions_xml(dialog, hkcaz, account, start_date, end_date)

Suggested fix

except FinTSUnsupportedOperation:
    hkcaz = self._find_highest_supported_command(HKCAZ1)
    result = self._get_transactions_xml(dialog, hkcaz, account, start_date, end_date)
    
    # Fix: Check if TAN is required before unpacking
    if isinstance(result, NeedTANResponse):
        return result
    
    booked_streams, pending_streams = result
    # ... rest unchanged

Happy to submit a PR if that helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions