From ce263b23f4fbba47677e66c2bba6e7a8f2c054a4 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Fri, 27 Sep 2024 12:22:59 +0100 Subject: [PATCH] fix error when being rate limited --- apps/home/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/home/views.py b/apps/home/views.py index 4f719c3..2d0c0ae 100644 --- a/apps/home/views.py +++ b/apps/home/views.py @@ -1,7 +1,8 @@ # -*- encoding: utf-8 -*- -import httpx +import json +import httpx from django.conf import settings from django.utils import timezone from asgiref.sync import sync_to_async @@ -36,6 +37,8 @@ class GuildsView(View): ) guild_data = response.json() + if "retry_after" in guild_data: + return JsonResponse(guild_data, safe=False) # guilds where the user either administrates or owns cleaned_guild_data = []