You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importsendgridimportosfromsendgrid.helpers.mailimport*frompython_http_clientimportexceptionssg=sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
from_email=Email("dx@sendgrid.com")
to_email=Email("elmer.thomas@sendgrid.com")
subject="Sending with SendGrid is Fun"content=Content("text/plain", "and easy to do anywhere, even with Python")
mail=Mail(from_email, subject, to_email, content)
try:
response=sg.client.mail.send.post(request_body=mail.get())
exceptexceptions.BadRequestsErrorase:
print(e.body)
exit()
print(response.status_code)
print(response.body)
print(response.headers)
The examples should go under USE_CASES.md and be referenced from TROUBLESHOOTING.md under error handling.
The text was updated successfully, but these errors were encountered:
Issue Summary
Here is a PR that implements the new error handling: sendgrid/python-http-client#17
Here is an example of usage:
The examples should go under USE_CASES.md and be referenced from TROUBLESHOOTING.md under error handling.
The text was updated successfully, but these errors were encountered: