We recommend using SendGrid Python, our client library, available on GitHub, with full documentation.
Do you have an API Key yet? If not, go get one. You're going to need it to integrate!
_19# using SendGrid's Python Library_19# https://github.com/sendgrid/sendgrid-python_19import os_19from sendgrid import SendGridAPIClient_19from sendgrid.helpers.mail import Mail_19_19message = Mail(_19 from_email='from_email@example.com',_19 to_emails='to@example.com',_19 subject='Sending with Twilio SendGrid is Fun',_19 html_content='<strong>and easy to do anywhere, even with Python</strong>')_19try:_19 sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))_19 response = sg.send(message)_19 print(response.status_code)_19 print(response.body)_19 print(response.headers)_19except Exception as e:_19 print(e.message)