From: Raphael Michel Date: Sat, 26 Oct 2024 14:40:38 +0000 (+0200) Subject: Fix imports, add to trouble script X-Git-Tag: v4.2.0~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4936e4a6c630e92225b6a12dc56b2d351d23426b;p=thirdparty%2Fpython-fints.git Fix imports, add to trouble script --- diff --git a/docs/trouble.rst b/docs/trouble.rst index f2ee010..0a4a9c7 100644 --- a/docs/trouble.rst +++ b/docs/trouble.rst @@ -103,7 +103,8 @@ the problem. "Fetch holdings", "Fetch scheduled debits", "Fetch status protocol", - "Make a simple transfer" + "Make a simple transfer", + "Fetch statements as PDF", ] print("Choose an operation") @@ -173,5 +174,19 @@ the problem. while isinstance(res, NeedTANResponse): res = ask_for_tan(res) + elif choice == 11: + print("Select statement") + statements = f.get_statements(account) + for i, statement in enumerate(statements): + print(i, f"Statement {statement.statement_number}/{statement.year}") + choice = int(input("Choice: ").strip()) + statement = statements[choice] + output_pdf = 'statement.pdf' + res = f.get_statement(account, statement.statement_number, statement.year, StatementFormat.PDF) + while isinstance(res, NeedTANResponse): + res = ask_for_tan(res) + with open(output_pdf, 'wb') as file: + file.write(res.data) + print("Written to", output_pdf) except FinTSUnsupportedOperation as e: print("This operation is not supported by this bank:", e) \ No newline at end of file diff --git a/fints/formals.py b/fints/formals.py index d3cddf5..313a839 100644 --- a/fints/formals.py +++ b/fints/formals.py @@ -1045,7 +1045,7 @@ class BookedCamtStatements1(DataElementGroup): camt_statements = DataElementField(type='bin', min_count=1, required=True, _d="camt-Umsätze gebucht") -@document_enum +@doc_enum class StatementFormat(RepresentableEnum): """Kontoauszugsformat @@ -1055,7 +1055,7 @@ class StatementFormat(RepresentableEnum): PDF = '3' # doc: printable format (e.g., PDF) -@document_enum +@doc_enum class Confirmation(RepresentableEnum): """Quittierung