From 15b46d2ac1dde64b0d0583b8c81896adfd5b216d Mon Sep 17 00:00:00 2001 From: Thomas Wade Date: Tue, 21 Apr 2020 17:01:31 +0930 Subject: [PATCH] Use more specific exception handling --- User.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/User.py b/User.py index b9bfffe..a3e6f46 100644 --- a/User.py +++ b/User.py @@ -72,7 +72,7 @@ class User: try: next_page_button = soup.select('.submission-list form button[type=submit]')[0] next_page_url = FAAPI.FA_BASE_URL + next_page_button.parent().get('action') - except: + except IndexError: # No next page, null the url to break the loop next_page_url = None @@ -93,7 +93,7 @@ class User: try: next_page_button = soup.select('.pagination a.button:last-child')[0] next_page_url = FAAPI.FA_BASE_URL + next_page_button.get('href') - except: + except IndexError: # No next page, null the url to break the loop next_page_url = None