Confirming EBICS downloads
The EBICS protocol requires downloads to be confirmed with the confirm_download method. Otherwise some banks will block further downloads of the same order type for a specific time.
client = EbicsClient(...) docs = client.C53() client.confirm_download()
Before we go further you have to understand the difference between a download with and without a specified date range:
- Downloads without a given date range will only contain new documents that have not been downloaded before. Think of it as a download queue from where you can remove documents with confirm_download(success=True). A confirmation with success=False keeps them in the queue.
- With a given date range you can also retrieve documents from the archive of already downloaded data. This way you are able to re-download files, even if already confirmed with success=True.
So you should confirm a download with success=True if the downloaded data was successfully processed by your application. Otherwise you should confirm with success=False:
client = EbicsClient(...) try: camt53 = client.C53() camt54 = client.C54() process_documents(camt53, camt54) except: client.confirm_download(success=False) raise else: client.confirm_download(success=True)
To simplify things there is a context manager (since v4.4) which automatically confirms all downloads at the end of the with-block:
with EbicsClient(...) as client: camt53 = client.C53() camt54 = client.C54() process_documents(camt53, camt54)
It does pretty much the same as the previous example.