]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Implement PSD2 for get_sepa_accounts
authorRaphael Michel <mail@raphaelmichel.de>
Sun, 22 Dec 2019 17:55:57 +0000 (18:55 +0100)
committerRaphael Michel <mail@raphaelmichel.de>
Sun, 22 Dec 2019 17:55:57 +0000 (18:55 +0100)
fints/client.py

index a12968c7b99437ef9b93f7e9a579700e2835ed33..1d7554f28ffec350ff465316670a39520e9978f8 100644 (file)
@@ -434,6 +434,13 @@ class FinTS3Client:
                 retval['accounts'].append(acc)
         return retval
 
+    def _get_sepa_accounts(self, command_seg, response):
+        self.accounts = []
+        for seg in response.find_segments(HISPA1, throw=True):
+            self.accounts.extend(seg.accounts)
+
+        return [a for a in [acc.as_sepa_account() for acc in self.accounts] if a]
+
     def get_sepa_accounts(self):
         """
         Returns a list of SEPA accounts
@@ -441,14 +448,9 @@ class FinTS3Client:
         :return: List of SEPAAccount objects.
         """
 
+        seg = HKSPA1()
         with self._get_dialog() as dialog:
-            response = dialog.send(HKSPA1())
-
-        self.accounts = []
-        for seg in response.find_segments(HISPA1, throw=True):
-            self.accounts.extend(seg.accounts)
-
-        return [a for a in [acc.as_sepa_account() for acc in self.accounts] if a]
+            return self._send_with_possible_retry(dialog, seg, self._get_sepa_accounts)
 
     def _continue_fetch_with_touchdowns(self, command_seg, response):
         for resp in response.response_segments(command_seg, *self._touchdown_args, **self._touchdown_kwargs):