python-fints icon indicating copy to clipboard operation
python-fints copied to clipboard

how to store the init tan request data?

Open drmhessler opened this issue 5 years ago • 4 comments

Trying to store the tan response data via tan_data= f.init_tan_response.get_data()

gives

File "/home/markus/.local/lib/python3.8/site-packages/fints/client.py", line 1028, in get_data "segments_bin": SegmentSequence([self.command_seg, self.tan_request]).render_bytes(), File "/home/markus/.local/lib/python3.8/site-packages/fints/types.py", line 222, in render_bytes return FinTS3Serializer().serialize_message(self) File "/home/markus/.local/lib/python3.8/site-packages/fints/parser.py", line 335, in serialize_message result.append(self.serialize_segment(segment)) File "/home/markus/.local/lib/python3.8/site-packages/fints/parser.py", line 344, in serialize_segment for name, field in segment._fields.items(): AttributeError: 'NoneType' object has no attribute '_fields'

How can I store the data and resuming via response= NeedRetryResponse.from_data(tan_data) f.send_tan(response,tan)?

drmhessler avatar May 16 '20 11:05 drmhessler

Please post a full, executable code sample that allows to reproduce the issue :)

raphaelm avatar Jun 07 '20 13:06 raphaelm

I have the same problem:

f = FinTS3PinTanClient(
    '123456789',  # Your bank's BLZ
    'myusername',  # Your login name
    getpass.getpass('PIN:'),  # Your banking PIN
    'https://hbci-pintan.gad.de/cgi-bin/hbciservlet',
    product_id='Your product ID'
)
with f:
  data = f.init_tan_response.get_data()

here the error occures

  dialog = f.pause_dialog()
clientData = f.deconstruct(True)
f = FinTS3PinTanClient(
    '123456789',  # Your bank's BLZ
    'myusername',  # Your login name
    getpass.getpass('PIN:'),  # Your banking PIN
    'https://hbci-pintan.gad.de/cgi-bin/hbciservlet',
    product_id='Your product ID',
    fromData=clientData
)
with f.resume_dialog(dialog):
  init_tan_response = fints.client.NeedRetryResponse.from_data(data)
  f.send_tan(init_tan_response, 'tan')

mwalliczek avatar Feb 10 '21 13:02 mwalliczek

The object init_tan_response looks like this: <o.__class__.__name__(command_seg=None, tan_request=fints.segments.auth.HITAN6(header=fints.formals.SegmentHeader('HITAN', 6, 6, 5), tan_process='4', task_reference='XXXXX#LPE#', challenge='Bitte geben Sie die photoTan ein', challenge_hhduc=b'\x00\timage/pngXXXXXXXXXX'))> command_seq is None -> maybe the cause for the serialization problem, because it iterates over all segments without any check, see https://github.com/raphaelm/python-fints/blob/bc1c81e0a42be245c6af24bb0885ce1b2407bd2a/fints/parser.py#L334

mwalliczek avatar Feb 10 '21 15:02 mwalliczek

see https://github.com/raphaelm/python-fints/pull/128

mwalliczek avatar Feb 22 '21 19:02 mwalliczek