1
0
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
Dustin 43bf08eae8 chase: Remove second page load wait
When there are multiple accounts associated with a Chase online banking
user, the dashboard page layout changes.  Detailed account history is no
longer shown, so the elements we were waiting for in the "Waiting for
page to load completely" step never appear. Since we're navigating
directly to the download account transactions page now, anyway, we do
not even need to wait for this button to appear.
2023-05-22 17:22:56 -05:00
Dustin 55d5f6bd1a Include error with ntfy failure messages
Although it is undocumented, *ntfy* accepts a `Message` header along
with a file upload, which sets the message content of the notification
when a file is attached.  Since HTTP headers cannot contain multiple
lines, the newline character has to be escaped.  The *ntfy* server
performs unescaping automatically.
2023-05-22 09:08:27 -05:00
1 changed files with 10 additions and 10 deletions

View File

@ -47,20 +47,22 @@ def ntfy(
if tags:
headers['Tags'] = tags
url = f'{NTFY_URL}/{topic}'
if message:
r = requests.post(
url,
headers=headers,
data=message,
)
else:
if attach:
if filename:
headers['Filename'] = filename
if message:
headers['Message'] = message.replace('\n', '\\n')
r = requests.put(
url,
headers=headers,
data=attach,
)
else:
r = requests.post(
url,
headers=headers,
data=message,
)
r.raise_for_status()
@ -269,6 +271,7 @@ class ntfyerror:
if ss := self.page.screenshot():
save_screenshot(ss)
ntfy(
message=str(exc_value),
title=f'xactfetch failed for {self.bank}',
tags='warning',
attach=ss,
@ -548,9 +551,6 @@ class Chase:
) -> Path:
log.info('Downloading transactions from %s to %s', from_date, to_date)
fmt = '%m/%d/%Y'
log.debug('Waiting for page to load completely')
self.page.get_by_role('link', name='Sort Options').wait_for()
self.page.wait_for_timeout(random.randint(1500, 2500))
href = '#/dashboard/accountDetails/downloadAccountTransactions/index'
self.page.evaluate(f'window.location.href = "{href}";')
log.debug('Waiting for page to load')