* The User Parameter Data (UPD) with information about the user account and allowed actions
.. autoclass:: fints.client.FinTS3Client
- :members: __init__, get_data, set_data
+ :members: __init__, deconstruct, set_data
:noindex:
:undoc-members:
-Using the :func:`~fints.client.FinTS3Client.get_data`/:func:`~fints.client.FinTS3Client.set_data`
+Using the :func:`~fints.client.FinTS3Client.deconstruct`/:func:`~fints.client.FinTS3Client.set_data`
facility is purely optional for reading operations, but may speed up the process because the BPD/UPD
can be cached and need not be transmitted again.
It may be required to use the facility for transaction operations if both parts of a two-step transaction
cannot be completed with the same :class:`~fints.client.FinTS3Client` object.
-The :func:`~fints.client.FinTS3Client.get_data` parameter `include_private` (defaults to `False`) enables
+The :func:`~fints.client.FinTS3Client.deconstruct` parameter `include_private` (defaults to `False`) enables
including the User Parameter Data in the datablob. Set this to `True` if you can sufficiently ensure the
privacy of the returned datablob (mostly: user name and account numbers).
user or context.
You SHOULD NOT call any other methods on the :class:`~fints.client.FinTS3Client` object
-after calling :func:`~fints.client.FinTS3Client.get_data`.
+after calling :func:`~fints.client.FinTS3Client.deconstruct`.
Keeping the dialog open
.. code-block:: python
datablob = ... # get from backend storage, or set to None
- client = FinTS3PinTanClient(..., set_data=datablob)
+ client = FinTS3PinTanClient(..., from_data=datablob)
with client:
accounts = client.get_sepa_accounts()
balance = client.get_balance(accounts[0])
transactions = client.get_transactions(accounts[0])
- datablob = client.get_data()
+ datablob = client.deconstruct()
# Store datablob to backend storage
For transactions involving TANs it may be required by the bank to issue both steps for one transaction
class FinTS3Client:
- def __init__(self, bank_identifier, user_id, customer_id=None, set_data: bytes=None):
+ def __init__(self, bank_identifier, user_id, customer_id=None, from_data: bytes=None):
self.accounts = []
if isinstance(bank_identifier, BankIdentifier):
self.bank_identifier = bank_identifier
self.response_callbacks = []
self._standing_dialog = None
- if set_data:
- self.set_data(bytes(set_data))
+ if from_data:
+ self.set_data(bytes(from_data))
def _new_dialog(self, lazy_init=False):
raise NotImplemented()
self.upa = SegmentSequence(data['upa_bin']).segments[0]
self.upd_version = data['upd_version']
- def _get_data_v1(self, including_private=False):
+ def _deconstruct_v1(self, including_private=False):
data = {
"system_id": self.system_id,
"bpd_bin": self.bpd.render_bytes(),
return data
- def get_data(self, including_private: bool=False) -> bytes:
- """Return state of this FinTSClient instance as an opaque datablob.
+ def deconstruct(self, including_private: bool=False) -> bytes:
+ """Return state of this FinTSClient instance as an opaque datablob. You should not
+ use this object after calling this method.
Information about the connection is implicitly retrieved from the bank and
cached in the FinTSClient. This includes: system identifier, bank parameter
Note: No connection information is stored in the datablob, neither is the PIN.
"""
- data = self._get_data_v1(including_private=including_private)
+ data = self._deconstruct_v1(including_private=including_private)
return compress_datablob(DATA_BLOB_MAGIC, 1, data)
def set_data(self, blob: bytes):
- """Restore a datablob created with get_data().
+ """Restore a datablob created with deconstruct().
You should only call this method once, and only immediately after constructing
the object and before calling any other method or functionality (e.g. __enter__()).
Commands MUST NOT be issued in the dialog after calling this method.
- MUST be used in conjunction with get_data()/set_data().
+ MUST be used in conjunction with deconstruct()/set_data().
Caller SHOULD ensure that the dialog is resumed (and properly ended) within a reasonable amount of time.
::
- client = FinTS3PinTanClient(..., set_data=None)
+ client = FinTS3PinTanClient(..., from_data=None)
with client:
challenge = client.sepa_transfer(...)
# dialog is now frozen, no new commands may be issued
# exiting the context does not end the dialog
- client_data = client.get_data()
+ client_data = client.deconstruct()
# Store dialog_data and client_data out-of-band somewhere
# ... Some time passes ...
# Later, possibly in a different process, restore the state
- client = FinTS3PinTanClient(..., set_data=client_data)
+ client = FinTS3PinTanClient(..., from_data=client_data)
with client.resume_dialog(dialog_data):
client.send_tan(...)
self.selected_security_function = data.get('selected_security_function', self.selected_security_function)
self.allowed_security_functions = data.get('allowed_security_functions', self.allowed_security_functions)
- def _get_data_v1(self, including_private=False):
- data = super()._get_data_v1(including_private=including_private)
+ def _deconstruct_v1(self, including_private=False):
+ data = super()._deconstruct_v1(including_private=including_private)
data.update({
"selected_security_function": self.selected_security_function,
"selected_tan_medium": self.selected_tan_medium,