Spaces:
Sleeping
Sleeping
Antigravity
feat: Cloud-ready release of AI Gmail Agent with premium glassmorphism telemetry dashboard and Dockerfile
e895030 | import base64 | |
| from bs4 import BeautifulSoup | |
| def extract_email_body(payload): | |
| if "parts" in payload: | |
| for part in payload["parts"]: | |
| data = part["body"].get("data") | |
| if not data: | |
| continue | |
| decoded = base64.urlsafe_b64decode( | |
| data | |
| ).decode(errors="ignore") | |
| mime = part.get("mimeType") | |
| if mime == "text/html": | |
| return BeautifulSoup( | |
| decoded, | |
| "html.parser" | |
| ).get_text() | |
| return decoded | |
| else: | |
| data = payload["body"].get("data") | |
| if data: | |
| return base64.urlsafe_b64decode( | |
| data | |
| ).decode(errors="ignore") | |
| return "" |