I have searched and searched but I'm not able to figure this out. Below is the JSON data I get back from the web service, API:
{
"total_count": 673,
"items": [
{
"hap": "delivered",
"message": "Delivered: [email protected] \u2192 [email protected] 'Some Email subject'",
"type": "info",
"created_at": "Wed, 19 Aug 2015 18:38:54 GMT",
"message_id": "[email protected]"
},
{
"hap": "accepted",
"message": "Accepted: [email protected] \u2192 [email protected] 'Subject of this email here'",
"type": "info",
"created_at": "Wed, 19 Aug 2015 18:38:53 GMT",
"message_id": "[email protected]"
},
{
"hap": "delivered",
"message": "Delivered: [email protected] \u2192 [email protected] 'Subject Line here'",
"type": "info",
"created_at": "Wed, 19 Aug 2015 18:37:50 GMT",
"message_id": "[email protected]"
},
The challenge is that I am trying to search the "message": block for the TO email address which comes after the "\u2192" inside the "message": location.
I have created this python script that dumps all entries inside "message": but I have not been able to filter this with a specific email address.
import requests, json
print("Connecting to the URL...")
r = requests.get("https://api:[email protected]/v3/example.com/log")
j = r.json()
for data in j['items']:
print data['message']