Spaces:
Running
Running
Ashraf Al-Kassem
Claude Sonnet 4.6
feat: LeadPilot β full project commit (Missions 1β13)
8d7950f Download backend/scripts/test_sendgrid_prod.py from ashrafkassem/LeadPilot: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/ashrafkassem/LeadPilot/resolve/main/backend/scripts/test_sendgrid_prod.py
- Command line
-
hf download hf://spaces/ashrafkassem/LeadPilot/backend/scripts/test_sendgrid_prod.py
-
curl -L -o test_sendgrid_prod.py https://huggingface.co/spaces/ashrafkassem/LeadPilot/resolve/main/backend/scripts/test_sendgrid_prod.py
1.07 kB
| import httpx | |
| import asyncio | |
| from app.core.config import settings | |
| async def test_sendgrid(): | |
| client = httpx.AsyncClient() | |
| headers = { | |
| 'Authorization': f'Bearer {settings.SENDGRID_API_KEY}', | |
| 'Content-Type': 'application/json' | |
| } | |
| payload = { | |
| 'personalizations': [{'to': [{'email': 'alkassem.ashraf@gmail.com'}], 'subject': 'Diagnostic Integration Test'}], | |
| 'from': {'email': settings.SENDGRID_FROM_EMAIL}, | |
| 'content': [{'type': 'text/plain', 'value': 'Verifying SendGrid API integration.'}] | |
| } | |
| print(f"API Key Starts With: {settings.SENDGRID_API_KEY[:7] if settings.SENDGRID_API_KEY else 'NONE'}") | |
| print(f"From Email: {settings.SENDGRID_FROM_EMAIL}") | |
| try: | |
| r = await client.post('https://api.sendgrid.com/v3/mail/send', headers=headers, json=payload) | |
| print('STATUS:', r.status_code) | |
| print('BODY:', r.text) | |
| except Exception as e: | |
| print('EXCEPTION:', repr(e)) | |
| finally: | |
| await client.aclose() | |
| if __name__ == '__main__': | |
| asyncio.run(test_sendgrid()) | |