Debug code to track down error in finding link_csv_download.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 19 Apr 2017 18:22:21 +0000 (20:22 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 19 Apr 2017 18:22:21 +0000 (20:22 +0200)
bob_download.py

index 242f184563be5940a659f8fe037a7c8eca264dd8..b701d01541e203baa933b692304c7bf7274d735a 100755 (executable)
@@ -81,6 +81,10 @@ def main(username, password, destdir, csv_format):
         response = session.get(urljoin(response.url, url))  # e.g. 'https://rechnung.bob.at/bill.ctn.cdr.obp?bsn=79'
         assert response.ok
         html = BeautifulSoup(response.text, 'html.parser')
+        if not html.find('a', id='link_csv_download'):
+            filepath = os.path.join(destdir, 'debug_no_link_csv_download.txt')
+            with open(filepath, 'wb') as file:
+                file.write(response.content)
         assert html.find('a', id='link_csv_download')
         response = session.get('https://rechnung.bob.at/obp/download.obp?fmt={}&table=obp.calls.table'.format(csv_format))
         assert response.ok