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
Copy file name to clipboardExpand all lines: TROUBLESHOOTING.md
+46-33Lines changed: 46 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,39 +4,29 @@ If you can't find a solution below, please open an [issue](https://github.com/se
4
4
5
5
## Table of Contents
6
6
7
+
*[Environment Variables and Your SendGrid API Key](#environment)
8
+
*[Error Messages](#error)
7
9
*[Migrating from v2 to v3](#migrating)
8
10
*[Continue Using v2](#v2)
9
11
*[Testing v3 /mail/send Calls Directly](#testing)
10
-
*[Error Messages](#error)
11
-
*[Versions](#versions)
12
-
*[Environment Variables and Your SendGrid API Key](#environment)
13
12
*[Using the Package Manager](#package-manager)
13
+
*[Version Convention](#versions)
14
+
*[Viewing the Request Body](#request-body)
14
15
15
-
<aname="migrating"></a>
16
-
## Migrating from v2 to v3
17
-
18
-
Please review [our guide](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) on how to migrate from v2 to v3.
19
-
20
-
<aname="v2"></a>
21
-
## Continue Using v2
22
-
23
-
[Here](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) is the last working version with v2 support.
16
+
<aname="environment"></a>
17
+
## Environment Variables and Your SendGrid API Key
24
18
25
-
Using pip:
19
+
All of our examples assume you are using [environment variables](https://github.com/sendgrid/sendgrid-python#setup-environment-variables) to hold your SendGrid API key.
26
20
27
-
```bash
28
-
pip uninstall sendgrid
29
-
pip install sendgrid=1.6.22
30
-
```
21
+
If you choose to add your SendGrid API key directly (not recommended):
31
22
32
-
Download:
23
+
`apikey=os.environ.get('SENDGRID_API_KEY')`
33
24
34
-
Click the "Clone or download" green button in [GitHub](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) and choose download.
25
+
becomes
35
26
36
-
<aname="testing"></a>
37
-
## Testing v3 /mail/send Calls Directly
27
+
`apikey='SENDGRID_API_KEY'`
38
28
39
-
[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.
29
+
In the first case SENDGRID_API_KEY is in reference to the name of the environment variable, while the second case references the actual SendGrid API Key.
40
30
41
31
<aname="error"></a>
42
32
## Error Messages
@@ -61,25 +51,32 @@ try:
61
51
except urllib.error.HTTPError as e:
62
52
print e.read()
63
53
```
64
-
<aname="versions"></a>
65
-
## Versions
66
54
67
-
We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guarenteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/sendgrid-python/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-python/releases) section.
55
+
<aname="migrating"></a>
56
+
## Migrating from v2 to v3
68
57
69
-
<aname="environment"></a>
70
-
## Environment Variables and Your SendGrid API Key
58
+
Please review [our guide](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/how_to_migrate_from_v2_to_v3_mail_send.html) on how to migrate from v2 to v3.
71
59
72
-
All of our examples assume you are using [environment variables](https://github.com/sendgrid/sendgrid-python#setup-environment-variables) to hold your SendGrid API key.
60
+
<aname="v2"></a>
61
+
## Continue Using v2
73
62
74
-
If you choose to add your SendGrid API key directly (not recommended):
63
+
[Here](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) is the last working version with v2 support.
75
64
76
-
`apikey=os.environ.get('SENDGRID_API_KEY')`
65
+
Using pip:
77
66
78
-
becomes
67
+
```bash
68
+
pip uninstall sendgrid
69
+
pip install sendgrid=1.6.22
70
+
```
79
71
80
-
`apikey='SENDGRID_API_KEY'`
72
+
Download:
81
73
82
-
In the first case SENDGRID_API_KEY is in reference to the name of the environment variable, while the second case references the actual SendGrid API Key.
74
+
Click the "Clone or download" green button in [GitHub](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) and choose download.
75
+
76
+
<aname="testing"></a>
77
+
## Testing v3 /mail/send Calls Directly
78
+
79
+
[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.
83
80
84
81
<aname="package-manager"></a>
85
82
## Using the Package Manager
@@ -93,3 +90,19 @@ In most cases we recommend you download the latest version of the library, but i
93
90
If you are usring a [requirements file](https://pip.readthedocs.io/en/1.1/requirements.html), please use:
94
91
95
92
`sendgrid==X.X.X`
93
+
94
+
<aname="versions"></a>
95
+
## Versioning Convention
96
+
97
+
We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guarenteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/sendgrid-python/blob/master/CHANGELOG.md) and [releases](https://github.com/sendgrid/sendgrid-python/releases) section.
98
+
99
+
<aname="request-body"></a>
100
+
## Viewing the Request Body
101
+
102
+
When debugging or testing, it may be useful to exampine the raw request body to compare against the [documented format](https://sendgrid.com/docs/API_Reference/api_v3.html).
103
+
104
+
You can do this right before you call `response = sg.client.mail.send.post(request_body=mail.get())` like so:
0 commit comments