joonis Logo

Dokumentation ebics.client

EBICS client module of the Python EBICS package.

This module defines the main EBICS client class.

class ebics.client.EbicsClient(keys, passphrase, url, hostid, partnerid, userid, systemid=None, keyversion='A006', version='H004')

Main EBICS client class.

Initializes the EBICS client instance.

Parameters:
  • keys – The path to a key file or a dictionary of keys. If the key file does not exist or the dictionary is empty, new keys (2048 bit) will be created.
  • passphrase – The passphrase by which all keys will be encrypted/decrypted.
  • url – The URL of the EBICS server.
  • hostid – The HostID of the bank.
  • partnerid – The assigned PartnerID (Kunden-ID).
  • userid – The assigned UserID (Teilnehmer-ID).
  • systemid – The assigned SystemID (usually unused).
  • keyversion – The key version of the electronic signature. Supported versions are A005 and A006 (default).
  • version – EBICS protocol version. At time the only supported version is 2.5 (H004).
C52(start=None, end=None, parsed=False)

Downloads Bank to Customer Account Reports (camt.52)

Parameters:
  • start – The start date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • parsed – Flag whether the received XML documents should be parsed and returned as structures of dictionaries or not.
Returns:

A dictionary of either raw XML documents or structures of dictionaries.

C53(start=None, end=None, parsed=False)

Downloads Bank to Customer Statements (camt.53)

Parameters:
  • start – The start date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • parsed – Flag whether the received XML documents should be parsed and returned as structures of dictionaries or not.
Returns:

A dictionary of either raw XML documents or structures of dictionaries.

C54(start=None, end=None, parsed=False)

Downloads Bank to Customer Debit Credit Notifications (camt.54)

Parameters:
  • start – The start date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • parsed – Flag whether the received XML documents should be parsed and returned as structures of dictionaries or not.
Returns:

A dictionary of either raw XML documents or structures of dictionaries.

CCT(document)

Uploads a SEPA Credit Transfer document.

Parameters:document – The SEPA document to be uploaded either as a raw XML string or a ebics.sepa.SEPACreditTransfer object.
Returns:The id of the uploaded order (OrderID).
CD1(document)

Uploads a SEPA Direct Debit document of type COR1.

Parameters:document – The SEPA document to be uploaded either as a raw XML string or a ebics.sepa.SEPADirectDebit object.
Returns:The id of the uploaded order (OrderID).
CDB(document)

Uploads a SEPA Direct Debit document of type B2B.

Parameters:document – The SEPA document to be uploaded either as a raw XML string or a ebics.sepa.SEPADirectDebit object.
Returns:The id of the uploaded order (OrderID).
CDD(document)

Uploads a SEPA Direct Debit document of type CORE.

Parameters:document – The SEPA document to be uploaded either as a raw XML string or a ebics.sepa.SEPADirectDebit object.
Returns:The id of the uploaded order (OrderID).
CDZ(parsed=False)

Downloads Payment Status Report for Direct Debits.

Parameters:parsed – Flag whether the received XML documents should be parsed and returned as structures of dictionaries or not.
Returns:A dictionary of either raw XML documents or structures of dictionaries.
CRZ(parsed=False)

Downloads Payment Status Report for Credit Transfers.

Parameters:parsed – Flag whether the received XML documents should be parsed and returned as structures of dictionaries or not.
Returns:A dictionary of either raw XML documents or structures of dictionaries.
HAA(parsed=False)

Downloads the available order types.

Parameters:parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:Either the raw XML document or a structure of dictionaries.
HAC(start=None, end=None, parsed=False)

Downloads the customer usage report in XML format.

Parameters:
  • start – The start date of requested processes. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested processes. Can be a date object or an ISO8601 formatted string.
  • parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:

Either the raw XML document or a structure of dictionaries.

HEV()

Returns a dictionary of supported protocol versions.

HIA()

Sends the public authentication (X002) and encryption (E002) keys.

HKD(parsed=False)

Downloads the customer properties and settings.

Parameters:parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:Either the raw XML document or a structure of dictionaries.
HPB()

Receives the public bank keys X002 and E002.

The keys are added to the key file and must be activated by calling the method EbicsClient.activate_bank_keys().

Returns:The string representation of the keys.
HPD(parsed=False)

Downloads the available bank parameters.

Parameters:parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:Either the raw XML document or a structure of dictionaries.
HTD(parsed=False)

Downloads the user properties and settings.

Parameters:parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:Either the raw XML document or a structure of dictionaries.
HVD(orderid, ordertype=None, partnerid=None, parsed=False)

This method is part of the distributed signature and downloads the signature status of a pending order.

Parameters:
  • orderid – The id of the order in question.
  • ordertype – The type of the order in question. If omitted or None, the corresponding order type is detected by calling the method EbicsClient.HVU().
  • partnerid – The partner id of the corresponding order. Defaults to the partner id of the current user.
  • parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:

Either the raw XML document or a structure of dictionaries.

HVE(orderid, ordertype=None, hash=None, partnerid=None)

This method is part of the distributed signature and signs a pending order.

Parameters:
  • orderid – The id of the order in question.
  • ordertype – The type of the order in question. If omitted or None, the corresponding order type is detected by calling the method EbicsClient.HVZ().
  • hash – The base64 encoded hash of the order to be signed. If omitted or None, the corresponding hash is detected by calling the method EbicsClient.HVZ().
  • partnerid – The partner id of the corresponding order. Defaults to the partner id of the current user.
HVS(orderid, ordertype=None, hash=None, partnerid=None)

This method is part of the distributed signature and cancels a pending order.

Parameters:
  • orderid – The id of the order in question.
  • ordertype – The type of the order in question. If omitted or None, the corresponding order type is detected by calling the method EbicsClient.HVZ().
  • hash – The base64 encoded hash of the order to be canceled. If omitted or None, the corresponding hash is detected by calling the method EbicsClient.HVZ().
  • partnerid – The partner id of the corresponding order. Defaults to the partner id of the current user.
HVT(orderid, ordertype=None, source=False, limit=100, offset=0, partnerid=None, parsed=False)

This method is part of the distributed signature and downloads the transaction details of a pending order.

Parameters:
  • orderid – The id of the order in question.
  • ordertype – The type of the order in question. If omitted or None, the corresponding order type is detected by calling the method EbicsClient.HVU().
  • source – Boolean flag whether the original document of the order should be returned or just a summary of the corresponding transactions.
  • limit – Constrains the number of transactions returned. Only applicable if source evaluates to False.
  • offset – Specifies the offset of the first transaction to return. Only applicable if source evaluates to False.
  • partnerid – The partner id of the corresponding order. Defaults to the partner id of the current user.
  • parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:

Either the raw XML document or a structure of dictionaries.

HVU(ordertypes=None, parsed=False)

This method is part of the distributed signature and downloads pending orders waiting to be signed.

Parameters:
  • ordertypes – An optional list of order types which are used to filter the result.
  • parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:

Either the raw XML document or a structure of dictionaries.

HVZ(ordertypes=None, parsed=False)

This method is part of the distributed signature and downloads pending orders waiting to be signed. It acts like a combination of EbicsClient.HVU() and EbicsClient.HVD().

Parameters:
  • ordertypes – An optional list of order types which are used to filter the result.
  • parsed – Flag whether the received XML document should be parsed and returned as a structure of dictionaries or not.
Returns:

Either the raw XML document or a structure of dictionaries.

INI()

Sends the public key of the electronic signature.

PTK(start=None, end=None)

Downloads the customer usage report in text format.

Parameters:
  • start – The start date of requested processes. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested processes. Can be a date object or an ISO8601 formatted string.
Returns:

The customer usage report.

SPR()

Locks the EBICS access of the current user.

STA(start=None, end=None, parsed=False)

Downloads the bank account statement in SWIFT format (MT940).

Parameters:
  • start – The start date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • parsed – Flag whether the received MT940 message should be parsed and returned as a dictionary or not. See function ebics.swift.parse_mt940().
Returns:

Either the raw data of the MT940 SWIFT message or the parsed message as dictionary.

VMK(start=None, end=None, parsed=False)

Downloads the interim transaction report in SWIFT format (MT942).

Parameters:
  • start – The start date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • end – The end date of requested transactions. Can be a date object or an ISO8601 formatted string.
  • parsed – Flag whether the received MT942 message should be parsed and returned as a dictionary or not. See function ebics.swift.parse_mt940().
Returns:

Either the raw data of the MT942 SWIFT message or the parsed message as dictionary.

activate_bank_keys()

Activates the bank keys downloaded via EbicsClient.HPB().

change_passphrase(passphrase)

Changes the passphrase by which all keys are encrypted. All available keys are updated and saved.

Parameters:passphrase – The new passphrase.
confirm_download(trans_id=None, success=True)

Confirms the receipt of a previously executed download.

It is usually used to mark received data, so that it is not included in further downloads.

Parameters:
  • trans_id – The transaction id of the download. If omitted or None, the transaction id of the last EBICS download is used (see last_trans_id).
  • success – Informs the EBICS server if the downloaded data was successfully processed or not.
create_ini_letter(bankname, path=None)

Creates the INI-letter as PDF.

Parameters:
  • bankname – The name of the bank which is printed on the INI-letter as the recipient.
  • path – The destination path of the created PDF file. If path is omitted or None the PDF is not saved.
Returns:

The PDF data as byte string if path is None.

download(order_type, params=None)

Performs an arbitrary EBICS download request.

Parameters:
  • order_type – The id of the intended order type.
  • params – A dictionary of parameters which are added to the EBICS request.
Returns:

The downloaded data. The returned transaction id is stored in the attribute last_trans_id.

hostid

The HostID of the bank (read-only).

keyfile

The path to the key file (read-only).

last_trans_id

This attribute stores the transaction id of the last download process (read-only).

partnerid

The PartnerID of the EBICS account (read-only).

save_keys(path=None)

Saves all keys to the file specified by path.

Parameters:path – The path of the key file. If path is omitted or None, the path of the current key file is used.
systemid

The SystemID of the EBICS account (read-only).

upload(order_type, data, params=None)

Performs an arbitrary EBICS upload request.

Parameters:
  • order_type – The id of the intended order type.
  • data – The data to be uploaded.
  • params – A dictionary of parameters which are added to the EBICS request.
Returns:

The id of the uploaded order if applicable.

url

The URL of the EBICS server (read-only).

userid

The UserID of the EBICS account (read-only).

version

The EBICS protocol version (read-only).

exception ebics.client.EbicsVerificationError

EBICS response could not be verified.

exception ebics.client.EbicsTechnicalError(code, message=None)

EBICS request returned a technical error.

exception ebics.client.EbicsFunctionalError(code, message=None)

EBICS request returned a functional error.

Examples

Initializing the EBICS account

from ebics.client import EbicsClient

client = EbicsClient(
    keys='~/mykeys',
    passphrase='secret',
    url='https://www.mybank.de/ebics',
    hostid='MYBANK',
    partnerid='CUSTOMER123',
    userid='USER1',
    )
# Send the public electronic signature key to the bank.
client.INI()
# Send the public authentication and encryption keys to the bank.
client.HIA()

# Create an INI letter which must be printed and sent to the bank.
client.create_ini_letter('MyBank AG', '~/ini_brief.pdf')

# After the account has been activated the public bank keys
# must be downloaded and checked for consistency.
print client.HPB()

# Finally the bank keys must be activated.
client.activate_bank_keys()

Download Bank to Customer Statements (camt.53)

from ebics.client import EbicsClient

client = EbicsClient(
    keys='~/mykeys',
    passphrase='secret',
    url='https://www.mybank.de/ebics',
    hostid='MYBANK',
    partnerid='CUSTOMER123',
    userid='USER1',
    )
# Download camt.53 documents
docs = client.C53('2014-02-01', '2014-02-07')
# Print all received documents
for name, xml in docs.items():
    print xml
# Print the transaction id for this download process
print client.last_trans_id

Kann ich
  Ihnen helfen?


Schreiben Sie mir
doch einfach unter
giraffe@joonis.de