diff --git a/gcn_email/core.py b/gcn_email/core.py index 7537575..0ddd253 100644 --- a/gcn_email/core.py +++ b/gcn_email/core.py @@ -8,6 +8,7 @@ from email.message import EmailMessage import logging import os +import json import boto3 from boto3.dynamodb.conditions import Key @@ -80,6 +81,11 @@ def kafka_message_to_email(message): email_message.add_attachment( message.value(), filename='notice.xml', maintype='application', subtype='xml') + elif topic.startswith('gcn.notices.'): + value = json.loads(message.value().decode()) + if 'healpix_file' in value: + value['healpix_file'] = 'This content is too large for email. To receive it, see https://gcn.nasa.gov/quickstart' + email_message.set_content(json.dumps(value, indent=4)) else: email_message.add_attachment( message.value(), filename='notice.bin',