Skip to content

Commit dc6f5db

Browse files
Merge pull request #327 from sendgrid/auto_deploy
Deploy automatically after successful build
2 parents c85533e + a958fe2 commit dc6f5db

File tree

3 files changed

+65
-34
lines changed

3 files changed

+65
-34
lines changed

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ install:
1212
- pip install pyyaml
1313
- pip install flask
1414
- pip install six
15+
- pip install pypandoc
1516
before_script:
1617
- mkdir prism
1718
- mkdir prism/bin
@@ -20,6 +21,16 @@ before_script:
2021
script:
2122
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then unit2 discover; else python -m unittest
2223
discover; fi
24+
before_deploy:
25+
- python ./register.py
26+
deploy:
27+
provider: pypi
28+
user: thinkingserious
29+
password:
30+
secure: DoM21KiMKkt/7AS6zOqTs7j3fgInrpswRTPG3cqBNRSzyfkXeXmKecCPruooxvYKLM7fPNDOuIH2phgCjdx/XBtJwghNh34n+TzhNFEiI/6pV0iS4a9gW0+QU+GMYvQmfNlA9DKQ5N20FMy4XeK8QQFarJXQwW1/a5wWftbUYvQ=
31+
distributions: sdist bdist_wheel
32+
on:
33+
tags: true
2334
notifications:
2435
hipchat:
2536
rooms:

TROUBLESHOOTING.md

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,29 @@ If you can't find a solution below, please open an [issue](https://github.com/se
44

55
## Table of Contents
66

7+
* [Environment Variables and Your SendGrid API Key](#environment)
8+
* [Error Messages](#error)
79
* [Migrating from v2 to v3](#migrating)
810
* [Continue Using v2](#v2)
911
* [Testing v3 /mail/send Calls Directly](#testing)
10-
* [Error Messages](#error)
11-
* [Versions](#versions)
12-
* [Environment Variables and Your SendGrid API Key](#environment)
1312
* [Using the Package Manager](#package-manager)
13+
* [Version Convention](#versions)
14+
* [Viewing the Request Body](#request-body)
1415

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

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

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):
3122

32-
Download:
23+
`apikey=os.environ.get('SENDGRID_API_KEY')`
3324

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

36-
<a name="testing"></a>
37-
## Testing v3 /mail/send Calls Directly
27+
`apikey='SENDGRID_API_KEY'`
3828

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

4131
<a name="error"></a>
4232
## Error Messages
@@ -61,25 +51,32 @@ try:
6151
except urllib.error.HTTPError as e:
6252
print e.read()
6353
```
64-
<a name="versions"></a>
65-
## Versions
6654

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

69-
<a name="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.
7159

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

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

76-
`apikey=os.environ.get('SENDGRID_API_KEY')`
65+
Using pip:
7766

78-
becomes
67+
```bash
68+
pip uninstall sendgrid
69+
pip install sendgrid=1.6.22
70+
```
7971

80-
`apikey='SENDGRID_API_KEY'`
72+
Download:
8173

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+
<a name="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.
8380

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

9592
`sendgrid==X.X.X`
93+
94+
<a name="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+
<a name="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:
105+
106+
```python
107+
print mail.get()
108+
```

register.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@
44
output = pypandoc.convert('README.md', 'rst')
55
f = open('README.txt','w+')
66
f.write(output)
7-
f.close()
7+
f.close()
8+
9+
readme_rst = open('./README.txt').read()
10+
replace = '.. figure:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :alt: SendGrid Logo\n\n SendGrid Logo\n'
11+
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'
12+
final_text = readme_rst.replace(replace,replacement)
13+
with open('./README.txt', 'w') as f:
14+
f.write(final_text)

0 commit comments

Comments
 (0)