import json

#{"_index":"ok_emails","_type":"_doc","_id":"bdtvRnwBvt423MHdM_RA","_score":1,"_ignored":["body.keyword"],"_source":{"subject":"good bye","to":[["ms@oathkeepers.org","ms@oathkeepers.org"]],"from":[["","biden_fans@protonmail.com"]],"date":"2021-01-19T20:26:08","body":"You may think that we're happy winning the White House and both houses of Congress, but we're not.\nWe want it all and we're going to take it from you by force. By the time we're done with you, you'll have nothing left. You'll soon be saying \"good bye\" to your second amendment right. Shortly after that you will lose your freedom of speech and then we will exterminate you in ways which you cannot possibly imagine.\n--- mail_boundary ---\n<div>You may think that we're happy winning the White House and both houses of Congress, but we're not.<br></div><div>We want it all and we're going to take it from you by force. By the time we're done with you, you'll have nothing left. You'll soon be saying \"good bye\" to your second amendment right. Shortly after that you will lose your freedom of speech and then we will exterminate you in ways which you cannot possibly imagine.<br></div>","mbox":"ms"}}

esf = open("ok_emails.json")

with esf as ef:
    for line in ef:
        email = json.loads(line.strip())
        for key in email["_source"].keys():
            print(key)
            print(str(email["_source"][key]).title(), email["_source"][key])
        print("\n\n\n============\n\n\n\n")

#        try:
#            print("To: ", email["_source"]["to"])
#            print("From: ", email["_source"]["from"])
#            print("Subject: ", email["_source"]["subject"] + "\n\n")
#            print(email["_source"]["body"])
          
        

#        try:
#            print( _dic["_source"]["u"]["username"],  "(", _dic["_source"]["u"]["name"], ")", ": ",  _#dic["_source"]["msg"])
#        except:
#            print( _dic["_source"]["u"]["username"], ": ",  _dic["_source"]["msg"])
