From e4efae906958b31df3a11ba931dc7e4ed068e86b Mon Sep 17 00:00:00 2001 From: gzbender Date: Fri, 12 Jul 2019 18:21:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=D0=B8=D1=81=D1=8C=20=D0=B3=D1=80=D0=B0=D0=BC?= =?UTF-8?q?=D0=BE=D1=82=D1=8B=20=D0=B7=D0=B0=20=D1=80=D0=B8=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BB=D0=B0=D0=B3?= =?UTF-8?q?=D0=B5=D1=80=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/notification/management/commands/animail_logs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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']))