Skip to content

Commit

Permalink
Update base path of legacy URLs (#72)
Browse files Browse the repository at this point in the history
* Add /ssohl prefix to legacy URLs

* Handle the case where table is not found

Otherwise the error is that None has no 'find' attribute
  • Loading branch information
maresb authored Dec 2, 2024
1 parent 2cd9b10 commit b4f2b5b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions dkb_robo/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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')
Expand All @@ -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:
Expand Down

0 comments on commit b4f2b5b

Please sign in to comment.