diff --git a/apps/notification/management/commands/animail_logs.py b/apps/notification/management/commands/animail_logs.py index a7e0f4bb..49f2bbeb 100644 --- a/apps/notification/management/commands/animail_logs.py +++ b/apps/notification/management/commands/animail_logs.py @@ -1,6 +1,5 @@ from django.core.management.base import BaseCommand from django.conf import settings -import json import requests class Command(BaseCommand): @@ -34,7 +33,10 @@ class Command(BaseCommand): "limit": options.get('limit'), "pretty": "yes", }) print(r) - messages = json.loads(r.content) + if r.status_code != 200: + print('r.content', r.content) + return + messages = r.json() print("len(messages['items'])", len(messages['items'])) no_attach = list(filter(lambda i: i['message']['headers']['subject'] == 'Грамота от Lil School' and not len( #options.get('subject') i['message']['attachments']), messages['items']))