Spaces:
Running
Running
Update test.py
Browse files
test.py
CHANGED
@@ -119,20 +119,20 @@ async def test_google(code:str):
|
|
119 |
message_data = message_response.json()
|
120 |
print(message_data)
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
|
137 |
# Check for parts in the message payload
|
138 |
if "payload" in message_data and "parts" in message_data["payload"]:
|
|
|
119 |
message_data = message_response.json()
|
120 |
print(message_data)
|
121 |
|
122 |
+
if 'payload' in message_data and 'headers' in message_data['payload']:
|
123 |
+
headers = message_data['payload']['headers']
|
124 |
+
for header in headers:
|
125 |
+
if header['name'] == 'Subject':
|
126 |
+
subject = header['value']
|
127 |
+
|
128 |
+
if 'parts' in message_data['payload']:
|
129 |
+
parts = message_data['payload']['parts']
|
130 |
+
for part in parts:
|
131 |
+
if part['mimeType'] == 'text/plain':
|
132 |
+
body_data = part['body']['data']
|
133 |
+
body = base64.urlsafe_b64decode(body_data).decode()
|
134 |
+
print("Subject:", subject)
|
135 |
+
print("Body:", body)
|
136 |
|
137 |
# Check for parts in the message payload
|
138 |
if "payload" in message_data and "parts" in message_data["payload"]:
|