From b7def140c6031fa4d292554d6c3bbef05ab5e451 Mon Sep 17 00:00:00 2001 From: James Dearlove Date: Sat, 9 Mar 2024 13:13:12 +1000 Subject: [PATCH] Fix up some new typing issues --- uqcsbot/dominos_coupons.py | 3 ++- uqcsbot/holidays.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/uqcsbot/dominos_coupons.py b/uqcsbot/dominos_coupons.py index b7eb7b5..445df8b 100644 --- a/uqcsbot/dominos_coupons.py +++ b/uqcsbot/dominos_coupons.py @@ -59,8 +59,9 @@ async def dominoscoupons( try: coupons = _get_coupons(number_of_coupons, ignore_expiry, keywords.split()) except RequestException as error: + resp_content = error.response.content if error.response else "No response error given." logging.warning( - f"Could not connect to dominos coupon site ({COUPONESE_DOMINOS_URL}): {error.response.content}" + f"Could not connect to dominos coupon site ({COUPONESE_DOMINOS_URL}): {resp_content}" ) await interaction.edit_original_response( content=f"Sadly could not reach the coupon website (<{COUPONESE_DOMINOS_URL}>)..." diff --git a/uqcsbot/holidays.py b/uqcsbot/holidays.py index 16adb0d..42e9ff6 100644 --- a/uqcsbot/holidays.py +++ b/uqcsbot/holidays.py @@ -103,7 +103,8 @@ def get_holiday_page() -> bytes | None: response = requests.get(HOLIDAY_URL) return response.content except RequestException as e: - logging.warning(e.response.content) + resp_content = e.response.content if e.response else "No response error given." + logging.warning(f"(RequestException) Could not fetch {HOLIDAY_URL}: {resp_content}") class Holidays(commands.Cog):