Skip to content

Commit b729f40

Browse files
docs: remove leading spaces on error handling example (#1032)
1 parent 76c5f46 commit b729f40

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

use_cases/error_handling.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ Please see [here](https://github.com/sendgrid/python-http-client/blob/HEAD/pytho
66
There are also email specific exceptions located [here](../sendgrid/helpers/mail/exceptions.py)
77

88
```python
9-
import os
10-
from sendgrid import SendGridAPIClient
11-
from sendgrid.helpers.mail import (From, To, Subject, PlainTextContent, HtmlContent, Mail)
12-
from python_http_client import exceptions
9+
import os
10+
from sendgrid import SendGridAPIClient
11+
from sendgrid.helpers.mail import (From, To, Subject, PlainTextContent, HtmlContent, Mail)
12+
from python_http_client import exceptions
1313

14-
sendgrid_client = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
15-
from_email = From("[email protected]")
16-
to_email = To("[email protected]")
17-
subject = Subject("Sending with Twilio SendGrid is Fun")
18-
plain_text_content = PlainTextContent("and easy to do anywhere, even with Python")
19-
html_content = HtmlContent("<strong>and easy to do anywhere, even with Python</strong>")
20-
message = Mail(from_email, to_email, subject, plain_text_content, html_content)
21-
try:
22-
response = sendgrid_client.send(message)
23-
print(response.status_code)
24-
print(response.body)
25-
print(response.headers)
26-
except exceptions.BadRequestsError as e:
27-
print(e.body)
28-
exit()
14+
sendgrid_client = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
15+
from_email = From("[email protected]")
16+
to_email = To("[email protected]")
17+
subject = Subject("Sending with Twilio SendGrid is Fun")
18+
plain_text_content = PlainTextContent("and easy to do anywhere, even with Python")
19+
html_content = HtmlContent("<strong>and easy to do anywhere, even with Python</strong>")
20+
message = Mail(from_email, to_email, subject, plain_text_content, html_content)
21+
try:
22+
response = sendgrid_client.send(message)
23+
print(response.status_code)
24+
print(response.body)
25+
print(response.headers)
26+
except exceptions.BadRequestsError as e:
27+
print(e.body)
28+
exit()
2929
```

0 commit comments

Comments
 (0)