Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install:
- pip install pyyaml
- pip install flask
- pip install six
- pip install pypandoc
before_script:
- mkdir prism
- mkdir prism/bin
Expand All @@ -20,6 +21,16 @@ before_script:
script:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then unit2 discover; else python -m unittest
discover; fi
before_deploy:
- python ./register.py
deploy:
provider: pypi
user: thinkingserious
password:
secure: DoM21KiMKkt/7AS6zOqTs7j3fgInrpswRTPG3cqBNRSzyfkXeXmKecCPruooxvYKLM7fPNDOuIH2phgCjdx/XBtJwghNh34n+TzhNFEiI/6pV0iS4a9gW0+QU+GMYvQmfNlA9DKQ5N20FMy4XeK8QQFarJXQwW1/a5wWftbUYvQ=
distributions: sdist bdist_wheel
on:
tags: true
notifications:
hipchat:
rooms:
Expand Down
79 changes: 46 additions & 33 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,29 @@ If you can't find a solution below, please open an [issue](https://github.com/se

## Table of Contents

* [Environment Variables and Your SendGrid API Key](#environment)
* [Error Messages](#error)
* [Migrating from v2 to v3](#migrating)
* [Continue Using v2](#v2)
* [Testing v3 /mail/send Calls Directly](#testing)
* [Error Messages](#error)
* [Versions](#versions)
* [Environment Variables and Your SendGrid API Key](#environment)
* [Using the Package Manager](#package-manager)
* [Version Convention](#versions)
* [Viewing the Request Body](#request-body)

<a name="migrating"></a>
## Migrating from v2 to v3

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.

<a name="v2"></a>
## Continue Using v2

[Here](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) is the last working version with v2 support.
<a name="environment"></a>
## Environment Variables and Your SendGrid API Key

Using pip:
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.

```bash
pip uninstall sendgrid
pip install sendgrid=1.6.22
```
If you choose to add your SendGrid API key directly (not recommended):

Download:
`apikey=os.environ.get('SENDGRID_API_KEY')`

Click the "Clone or download" green button in [GitHub](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) and choose download.
becomes

<a name="testing"></a>
## Testing v3 /mail/send Calls Directly
`apikey='SENDGRID_API_KEY'`

[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.
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.

<a name="error"></a>
## Error Messages
Expand All @@ -61,25 +51,32 @@ try:
except urllib.error.HTTPError as e:
print e.read()
```
<a name="versions"></a>
## Versions

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.
<a name="migrating"></a>
## Migrating from v2 to v3

<a name="environment"></a>
## Environment Variables and Your SendGrid API Key
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.

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.
<a name="v2"></a>
## Continue Using v2

If you choose to add your SendGrid API key directly (not recommended):
[Here](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) is the last working version with v2 support.

`apikey=os.environ.get('SENDGRID_API_KEY')`
Using pip:

becomes
```bash
pip uninstall sendgrid
pip install sendgrid=1.6.22
```

`apikey='SENDGRID_API_KEY'`
Download:

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.
Click the "Clone or download" green button in [GitHub](https://github.com/sendgrid/sendgrid-python/tree/0942f9de2d5ba5fedb65a23940ebe1005a21a6c7) and choose download.

<a name="testing"></a>
## Testing v3 /mail/send Calls Directly

[Here](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html) are some cURL examples for common use cases.

<a name="package-manager"></a>
## Using the Package Manager
Expand All @@ -93,3 +90,19 @@ In most cases we recommend you download the latest version of the library, but i
If you are usring a [requirements file](https://pip.readthedocs.io/en/1.1/requirements.html), please use:

`sendgrid==X.X.X`

<a name="versions"></a>
## Versioning Convention

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.

<a name="request-body"></a>
## Viewing the Request Body

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).

You can do this right before you call `response = sg.client.mail.send.post(request_body=mail.get())` like so:

```python
print mail.get()
```
9 changes: 8 additions & 1 deletion register.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
output = pypandoc.convert('README.md', 'rst')
f = open('README.txt','w+')
f.write(output)
f.close()
f.close()

readme_rst = open('./README.txt').read()
replace = '.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :alt: SendGrid Logo\n\n SendGrid Logo\n'
replacement = '|SendGrid Logo|\n\n.. |SendGrid Logo| image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :target: https://www.sendgrid.com'
final_text = readme_rst.replace(replace,replacement)
with open('./README.txt', 'w') as f:
f.write(final_text)