Skip to main content
JSON Notices via Email, Kafka Cron Jobs, Submitter Profile, GCN is Hiring. See news and announcements

Plain Text

GCN Classic Notices are also distributed as plain text. To extract header information, one can use Python's built-in email library.

import email

def parse_text_alert_to_dict(message_value):
    return dict(email.message_from_bytes(message_value))

This function extracts the headers and returns them as key-value pairs in a Python dictionary.

Looking for U.S. government information and services? Visit USA.gov