From b4f2b5b73ffc67d29dcc1699efc7f9928dc343e0 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Mon, 2 Dec 2024 07:06:27 +0100 Subject: [PATCH] Update base path of legacy URLs (#72) * Add /ssohl prefix to legacy URLs * Handle the case where table is not found Otherwise the error is that None has no 'find' attribute --- dkb_robo/legacy.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dkb_robo/legacy.py b/dkb_robo/legacy.py index f7b550b..b5a2211 100644 --- a/dkb_robo/legacy.py +++ b/dkb_robo/legacy.py @@ -353,7 +353,7 @@ def _get_financial_statement(self) -> bs4.BeautifulSoup: """ get finanical statement """ self.logger.debug('legacy.Wrapper._get_financial_statement()\n') - statement_url = self.base_url + '/DkbTransactionBanking/content/banking/financialstatus/FinancialComposite/FinancialStatus.xhtml?$event=init' + statement_url = self.base_url + '/ssohl/DkbTransactionBanking/content/banking/financialstatus/FinancialComposite/FinancialStatus.xhtml?$event=init' self.dkb_br.open(statement_url) soup = self.dkb_br.get_current_page() @@ -652,7 +652,7 @@ def get_credit_limits(self) -> Dict[str, str]: """ create a dictionary of credit limits of the different accounts """ self.logger.debug('legacy.Wrapper.get_credit_limits()\n') - limit_url = self.base_url + '/DkbTransactionBanking/content/service/CreditcardLimit.xhtml' + limit_url = self.base_url + '/ssohl/DkbTransactionBanking/content/service/CreditcardLimit.xhtml' self.dkb_br.open(limit_url) soup = self.dkb_br.get_current_page() @@ -674,7 +674,7 @@ def get_exemption_order(self) -> Dict[str, str]: """ returns a dictionary of the stored exemption orders """ self.logger.debug('legacy.Wrapper.get_exemption_order()\n') - exo_url = self.base_url + '/DkbTransactionBanking/content/personaldata/ExemptionOrderOverview.xhtml' + exo_url = self.base_url + '/ssohl/DkbTransactionBanking/content/personaldata/ExemptionOrderOverview.xhtml' self.dkb_br.open(exo_url) soup = self.dkb_br.get_current_page() @@ -756,7 +756,7 @@ def get_standing_orders(self, _uid: str = None) -> List[str]: """ get standing orders """ self.logger.debug('legacy.Wrapper.get_standing_orders()\n') - so_url = self.base_url + '/banking/finanzstatus/dauerauftraege?$event=infoStandingOrder' + so_url = self.base_url + '/ssohl/banking/finanzstatus/dauerauftraege?$event=infoStandingOrder' self.dkb_br.open(so_url) so_list = [] @@ -810,7 +810,7 @@ def login(self) -> Tuple[Dict[str, str], str]: self.logger.debug('legacy.Wrapper.login()\n') # login url - login_url = self.base_url + '/' + 'banking' + login_url = self.base_url + '/ssohl/' + 'banking' # create browser and login self.dkb_br = self._new_instance() @@ -866,7 +866,7 @@ def logout(self): """ logout from DKB banking area """ self.logger.debug('legacy.Wrapper.logout()\n') - logout_url = self.base_url + '/' + 'DkbTransactionBanking/banner.xhtml?$event=logout' + logout_url = self.base_url + '/ssohl/' + 'DkbTransactionBanking/banner.xhtml?$event=logout' if self.dkb_br: self.dkb_br.open(logout_url) self.logger.debug('legacy.Wrapper.logout() ended\n') @@ -876,15 +876,17 @@ def scan_postbox(self, path: str = None, download_all: bool = False, archive: bo self.logger.debug('legacy.Wrapper.san_postbox() path: %s, download_all: %s, archive: %s, prepend_date: %s\n', path, download_all, archive, prepend_date) if archive: - pb_url = self.base_url + '/banking/postfach/ordner?$event=gotoFolder&folderNameOrId=archiv' + pb_url = self.base_url + '/ssohl/banking/postfach/ordner?$event=gotoFolder&folderNameOrId=archiv' else: - pb_url = self.base_url + '/banking/postfach' + pb_url = self.base_url + '/ssohl/banking/postfach' self.dkb_br.open(pb_url) soup = self.dkb_br.get_current_page() if archive: table = soup.find('table', attrs={'id': re.compile('mbo-message-list*')}) else: table = soup.find('table', attrs={'id': 'welcomeMboTable'}) + if table is None: + raise DKBRoboError("Expected table not found in old postbox") tbody = table.find('tbody') if archive: