diff --git a/chzzk/management/commands/import_chzzk_campaign.py b/chzzk/management/commands/import_chzzk_campaign.py index 484dd66..6288923 100644 --- a/chzzk/management/commands/import_chzzk_campaign.py +++ b/chzzk/management/commands/import_chzzk_campaign.py @@ -52,7 +52,17 @@ class Command(BaseCommand): "User-Agent": USER_AGENT, }, ) - resp.raise_for_status() + try: + resp.raise_for_status() + except requests.HTTPError as e: + json_msg: str = "" + if resp.headers.get("Content-Type", "").startswith("application/json"): + error_data = resp.json() + json_msg = error_data.get("message", "") + + msg: str = f"Failed to fetch campaign {campaign_no}: {e} - {json_msg}" + self.stdout.write(self.style.ERROR(msg)) + return data: dict[str, Any] = resp.json() campaign_data: ChzzkCampaignV2 diff --git a/templates/chzzk/campaign_list.html b/templates/chzzk/campaign_list.html index 04b9025..bede94f 100644 --- a/templates/chzzk/campaign_list.html +++ b/templates/chzzk/campaign_list.html @@ -47,7 +47,11 @@ {% if is_paginated %} - {% include "includes/pagination.html" with page_obj=page_obj %} +
No campaigns found.