SendGrid default script freezes my Ubuntu 21.10 instance
Closed this issue · 2 comments
espressobeanies commented
Issue Summary
Ubuntu 21.10 instance freezes/locks-up after running the default SendGrid python script. Yes the API key is listed as an environment variable. No output is provided when the system freezes.
Steps to Reproduce
- Using Ubuntu 21.04, go through SendGrid python deployment tutorial
- Run the SendGrid script testing an API key with full access ability
- Watch system hang up in 1 minute
Code Snippet
# using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
message = Mail(
from_email='something@example.com',
to_emails='<redacted>',
subject='Sending with Twilio SendGrid is Fun',
html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
response = sg.send(message)
print(response.status_code)
print(response.body)
print(response.headers)
except Exception as e:
print(e.message)
Exception/Log
I have no exception log
Technical details:
- sendgrid-python version: 6.8.3
- python version: Python 3.9.7
shwetha-manvinkurke commented
Can you try adding a timeout to help pin point the exact issue?
sg.client.timeout = 10
JenniferMah commented
Closing due to inactivity. Please open a new Github issue if you need help.