Skip to content

Commit

Permalink
small fixes (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katzmann1983 committed Sep 4, 2024
1 parent 0472673 commit e06a322
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
8 changes: 1 addition & 7 deletions pytr/dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pytr/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"card_successful_atm_withdrawal": "REMOVAL",
"card_order_billed": "REMOVAL",
"card_refund": "DEPOSIT",
"card_failed_transaction": "REMOVAL",
}


Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions pytr/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
8 changes: 7 additions & 1 deletion pytr/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e06a322

Please sign in to comment.