From 544fd3a31c37f4df55d2cc71f27e047d2ab3ab22 Mon Sep 17 00:00:00 2001 From: javex Date: Tue, 26 Sep 2023 21:22:41 +0930 Subject: [PATCH] Add error printing for coles.py --- coles.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coles.py b/coles.py index 8779c9d..bd0b08c 100644 --- a/coles.py +++ b/coles.py @@ -39,7 +39,11 @@ def get_category(self, cat_slug): while True: print(f'Page {params["page"]}') response = self.session.get(f'https://www.coles.com.au/_next/data/20230922.01_v3.52.0/en/browse/{cat_slug}.json', params=params) - response.raise_for_status() + try: + response.raise_for_status() + except requests.HTTPError: + print(response.text) + raise response_data = response.json() search_results = response_data['pageProps']['searchResults'] for result in search_results['results']: