Skip to content

Commit d032f46

Browse files
Add Python 3 error retrieval example
1 parent 45f9c93 commit d032f46

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

TROUBLESHOOTING.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Click the "Clone or download" green button in [GitHub](https://github.com/sendgr
4242
<a name="error"></a>
4343
## Error Messages
4444

45-
To read the error message returned by SendGrid's API:
45+
To read the error message returned by SendGrid's API in Python 2.X:
4646

4747
```python
4848
import urllib2
@@ -53,6 +53,15 @@ except urllib2.HTTPError as e:
5353
print e.read()
5454
```
5555

56+
To read the error message returned by SendGrid's API in Python 3.X:
57+
58+
```python
59+
import urllib
60+
try:
61+
response = sg.client.mail.send.post(request_body=mail.get())
62+
except urllib.error.HTTPError as e:
63+
print e.read()
64+
```
5665
<a name="versions"></a>
5766
## Versions
5867

0 commit comments

Comments
 (0)