|
| 1 | +If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com). |
| 2 | + |
| 3 | +If you can't find a solution below, please open an [issue](https://github.com/sendgrid/sendgrid-python/issues). |
| 4 | + |
| 5 | + |
| 6 | +## Table of Contents |
| 7 | + |
| 8 | +* [Migrating from v2 to v3](#migrating) |
| 9 | +* [Continue Using v2](#v2) |
| 10 | +* [Testing v3 /mail/send Calls Directly](#testing) |
| 11 | +* [Error Messages](#error) |
| 12 | +* [Versions](#versions) |
| 13 | +* [Environment Variables and Your SendGrid API Key](#environment) |
| 14 | +* [Using the Package Manager](#package-manager) |
| 15 | + |
| 16 | +<a name="migrating"></a> |
| 17 | +## Migrating from v2 to v3 |
| 18 | + |
| 19 | +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. |
| 20 | + |
| 21 | +<a name="v2"></a> |
| 22 | +## Continue Using v2 |
| 23 | + |
| 24 | +[Here](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) is the last working version with v2 support. |
| 25 | + |
| 26 | +Using pip: |
| 27 | + |
| 28 | +```bash |
| 29 | +pip uninstall sendgrid |
| 30 | +pip install sendgrid=1.6.22 |
| 31 | +``` |
| 32 | + |
| 33 | +Download: |
| 34 | + |
| 35 | +Click the "Clone or download" green button in [GitHub](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) and choose download. |
| 36 | + |
| 37 | +<a name="testing"></a> |
| 38 | +## Testing v3 /mail/send Calls Directly |
| 39 | + |
| 40 | +[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases. |
| 41 | + |
| 42 | +<a name="error"></a> |
| 43 | +## Error Messages |
| 44 | + |
| 45 | +To read the error message returned by SendGrid's API: |
| 46 | + |
| 47 | +```python |
| 48 | +try: |
| 49 | + response = sg.client.mail.send.post(request_body=mail.get()) |
| 50 | +except urllib2.HTTPError as e: |
| 51 | + print e.read() |
| 52 | +``` |
| 53 | + |
| 54 | +<a name="versions"></a> |
| 55 | +## Versions |
| 56 | + |
| 57 | +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. |
| 58 | + |
| 59 | +<a name="environment"></a> |
| 60 | +## Environment Variables and Your SendGrid API Key |
| 61 | + |
| 62 | +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. |
| 63 | + |
| 64 | +If you choose to add your SendGrid API key directly (not recommended): |
| 65 | + |
| 66 | +`apikey=os.environ.get('SENDGRID_API_KEY')` |
| 67 | + |
| 68 | +becomes |
| 69 | + |
| 70 | +`apikey='SENDGRID_API_KEY'` |
| 71 | + |
| 72 | +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. |
| 73 | + |
| 74 | +<a name="package-manager"></a> |
| 75 | +## Using the Package Manager |
| 76 | + |
| 77 | +We upload this library to [PyPI](https://pypi.python.org/pypi/sendgrid) whenever we make a release. This allows you to use [pip](https://pypi.python.org/pypi/pip) for easy installation. |
| 78 | + |
| 79 | +In most cases we recommend you download the latest version of the library, but if you need a different version, please use: |
| 80 | + |
| 81 | +`pip install sendgrid==X.X.X` |
| 82 | + |
| 83 | +If you are usring a [requirements file](https://pip.readthedocs.io/en/1.1/requirements.html), please use: |
| 84 | + |
| 85 | +`sendgrid==X.X.X` |
0 commit comments