diff --git a/pytr/dl.py b/pytr/dl.py index 233afe6..c85e239 100644 --- a/pytr/dl.py +++ b/pytr/dl.py @@ -3,7 +3,6 @@ from concurrent.futures import as_completed from pathlib import Path from requests_futures.sessions import FuturesSession -from requests import session from pathvalidate import sanitize_filepath @@ -35,12 +34,7 @@ def __init__( self.since_timestamp = since_timestamp self.universal_filepath = universal_filepath - requests_session = session() - if self.tr._weblogin: - requests_session.headers = self.tr._default_headers_web - else: - requests_session.headers = self.tr._default_headers - self.session = FuturesSession(max_workers=max_workers, session=requests_session) + self.session = FuturesSession(max_workers=max_workers, session=self.tr._websession) self.futures = [] self.docs_request = 0 diff --git a/pytr/event.py b/pytr/event.py index 0f891ab..46252f5 100644 --- a/pytr/event.py +++ b/pytr/event.py @@ -19,6 +19,7 @@ "card_successful_atm_withdrawal": "REMOVAL", "card_order_billed": "REMOVAL", "card_refund": "DEPOSIT", + "card_failed_transaction": "REMOVAL", } @@ -39,6 +40,9 @@ def date(self): @property def is_pp_relevant(self): + if self.event["eventType"] == "card_failed_transaction": + if self.event["status"] == "CANCELED": + return False return self.pp_type != "" @property diff --git a/pytr/transactions.py b/pytr/transactions.py index f83600a..e90449b 100644 --- a/pytr/transactions.py +++ b/pytr/transactions.py @@ -11,11 +11,6 @@ def export_transactions(input_path, output_path, lang="auto"): """ Create a CSV with the deposits and removals ready for importing into Portfolio Performance The CSV headers for PP are language dependend - - i18n source from Portfolio Performance: - https://github.com/buchen/portfolio/blob/93b73cf69a00b1b7feb136110a51504bede737aa/name.abuchen.portfolio/src/name/abuchen/portfolio/messages_de.properties - https://github.com/buchen/portfolio/blob/effa5b7baf9a918e1b5fe83942ddc480e0fd48b9/name.abuchen.portfolio/src/name/abuchen/portfolio/model/labels_de.properties - """ log = get_logger(__name__) if lang == "auto": diff --git a/pytr/translation.py b/pytr/translation.py index 7754492..1e44a13 100644 --- a/pytr/translation.py +++ b/pytr/translation.py @@ -7,7 +7,13 @@ def setup_translation(language="en"): - """Set up translations for the specified language.""" + """Set up translations for the specified language. + + i18n source from Portfolio Performance: + https://github.com/buchen/portfolio/blob/93b73cf69a00b1b7feb136110a51504bede737aa/name.abuchen.portfolio/src/name/abuchen/portfolio/messages_de.properties + https://github.com/buchen/portfolio/blob/effa5b7baf9a918e1b5fe83942ddc480e0fd48b9/name.abuchen.portfolio/src/name/abuchen/portfolio/model/labels_de.properties + + """ # Get the absolute path of the locale directory locale_dir = os.path.join( os.path.dirname(__file__), ".", "locale"