Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conformance to style standards #654

Closed
wants to merge 81 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
1936e24
Get unassigned IPs #392, made helper function
d-grossman Oct 17, 2017
c8fc9eb
break up tests
d-grossman Oct 17, 2017
df73eb0
make the python2.6 travis build happy
d-grossman Oct 17, 2017
9f0932f
Add global stats helper
aaronmak Oct 22, 2017
eb65f75
Add child class CategoryStats
aaronmak Oct 22, 2017
a1fab67
fix typo
aaronmak Oct 22, 2017
67d0b63
Clean up json and refine CategoryStats Class
aaronmak Oct 22, 2017
f8183a6
Add SubuserStats class
aaronmak Oct 22, 2017
57439d9
Add to readme
aaronmak Oct 22, 2017
857f49e
Merge remote-tracking branch 'sendgrid/master' into add_stats_helper
aaronmak Oct 22, 2017
246efcc
add tests for stats helper
aaronmak Oct 27, 2017
760c5f1
Add more tests
aaronmak Oct 27, 2017
b12cb7b
add more tests
aaronmak Oct 27, 2017
1b9f336
Add slack event integration
navinpai Oct 28, 2017
57c3040
docker-compose for issue #444
heisendumb Oct 30, 2017
b916a6d
added args to Dockerfile
heisendumb Oct 30, 2017
af559cf
edit USAGE.md
heisendumb Oct 30, 2017
3c2724c
issue #444 done
heisendumb Oct 30, 2017
2a9b404
moved file, updated import
d-grossman Nov 3, 2017
31bf37a
Merge branch 'master' of https://github.com/sendgrid/sendgrid-python
d-grossman Nov 3, 2017
955cac6
removed extra examples dir
mbernier Dec 12, 2017
6b2ac92
Merge branch 'master' of https://github.com/sendgrid/sendgrid-python
mbernier Dec 21, 2017
7bde27a
fixed tests for docker files
mbernier Dec 21, 2017
7ccbf5d
Update Readme
bchandaka Jul 8, 2018
2da51c2
Update README.md
bchandaka Jul 8, 2018
6d5e990
Add a tutorial to deploy a simple 'Hello Email' app on Heroku
swapagarwal Oct 26, 2017
b002197
Adds support for dynamic template data in personalizations
0bsearch Aug 1, 2018
210a4fa
Example for .md usecase
0bsearch Aug 1, 2018
8ff82a8
Linking SG dashboard
0bsearch Aug 1, 2018
65f4857
Change type of category in Mail.add_category from string to Category
lifez Aug 3, 2018
0ca2578
Install pip for python3.6
lifez Aug 3, 2018
382b5e8
Update TROUBLESHOOTING.md
Cabalist Aug 3, 2018
f2c48e3
Updated README for more info
af4ro Aug 6, 2018
6adc948
fixed assertion error
Aug 6, 2018
4fbb92e
Merge branch 'master' into master
af4ro Aug 6, 2018
946a683
readme tag update
af4ro Aug 7, 2018
342b66b
Merge pull request #599 from sendgrid/af4ro-patch-1
thinkingserious Aug 8, 2018
889a3cf
Merge pull request #600 from sendgrid/af4ro-patch-2
thinkingserious Aug 8, 2018
cbd29ac
Merge branch 'master' into master
af4ro Aug 8, 2018
b06bc3e
Merge pull request #588 from bchandaka/master
thinkingserious Aug 8, 2018
e1cc256
minor formatting
af4ro Aug 9, 2018
54aa6ec
Minor readability update
af4ro Aug 10, 2018
5d513e4
Merge branch 'master' into slack_event_integration
navinpai Aug 13, 2018
0c2163c
Add slack API integration to use_cases
navinpai Aug 13, 2018
5364bf9
update TROUBLESHOOTING.md
jpurpura Aug 13, 2018
d1395e2
Merge pull request #603 from sendgrid/jpurpura-patch-1
thinkingserious Aug 13, 2018
51bbf57
Merge pull request #601 from sendgrid/af4ro-patch-3
thinkingserious Aug 14, 2018
2d7af3c
Merge pull request #478 from navinpai/slack_event_integration
thinkingserious Aug 14, 2018
07ed322
Added comment for attachments to be base64 encoded
Aug 14, 2018
e8a8c21
Merge branch 'master' of https://github.com/d-grossman/sendgrid-pytho…
thinkingserious Aug 16, 2018
3ec8e65
Add missing dependencies
thinkingserious Aug 16, 2018
26b3e81
Merge branch 'd-grossman-master'
thinkingserious Aug 16, 2018
9fd72fd
Merge pull request #408 from aaronmak/add_stats_helper
thinkingserious Aug 16, 2018
cd31fc8
Merge pull request #443 from swapagarwal/flask-heroku
thinkingserious Aug 16, 2018
0065cdc
Merge pull request #497 from heisendumb/master
thinkingserious Aug 16, 2018
7f6ed60
Merge pull request #595 from lifez/fix-docstring-for-add_category
thinkingserious Aug 16, 2018
7221ccd
Merge pull request #598 from Cabalist/patch-1
thinkingserious Aug 16, 2018
6102136
Merge pull request #604 from sendgrid/agnesjang98-patch-issue-547
thinkingserious Aug 16, 2018
7bb94ac
Merge pull request #596 from lifez/fix-docker-build
thinkingserious Aug 16, 2018
793aad7
Version Bump v5.5.0: Pre-Dynamic Template Roll Up Release
thinkingserious Aug 16, 2018
68b9eb0
Merge branch 'dynamic_template_support' of https://github.com/3lnc/se…
thinkingserious Aug 16, 2018
28bd2a5
Merge #593
thinkingserious Aug 21, 2018
4be8d58
Merge branch '3lnc-dynamic_template_support'
thinkingserious Aug 21, 2018
7438ae1
Version Bump v5.6.0: Dynamic Template support
thinkingserious Aug 21, 2018
fe61c16
Fix CHANGELOG attribution
thinkingserious Aug 21, 2018
84f7cf2
Typo in comments
thinkingserious Aug 22, 2018
27b302f
Fix format of dependency `pytest`
cmccandless Sep 13, 2018
aba7f04
fixes #610
themousepotato Sep 28, 2018
29fa10d
Update README.md by including email
bharatr21 Oct 1, 2018
a8907d8
Fix typos
hugovk Oct 1, 2018
308c19e
Merge pull request #611 from themousepotato/potato-patch
thinkingserious Oct 1, 2018
dc45b63
Merge pull request #616 from hugovk/fix-typos
thinkingserious Oct 2, 2018
1a1d3a5
Update README.md for Email and fix alphabetical order
bharatr21 Oct 3, 2018
3e09b20
Fix merge conflicts
bharatr21 Oct 3, 2018
80788ed
Update README
Jeremyyang920 Oct 3, 2018
f132e5b
Merge pull request #619 from cmccandless/fix-dependency-format
thinkingserious Oct 4, 2018
3692e71
Merge pull request #613 from Bharat123rox/patch-1
thinkingserious Oct 4, 2018
1627df7
Merge pull request #628 from sendgrid/Jeremyyang920-patch-1
thinkingserious Oct 5, 2018
1bd4a31
Add PEP8 code compliance according to pycodestyle
movanelli Oct 7, 2018
6665395
Update .travis.yml to execute pycodestyle validating PEP8 Errors
movanelli Oct 7, 2018
5a84109
Add PEP8 code compliance according to pycodestyle
movanelli Oct 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Closes #2
-
-

If you have questions, please send an email to [Sendgrid](mailto:dx@sendgrid.com), or file a Github Issue in this repository.
If you have questions, please send an email to [SendGrid](mailto:dx@sendgrid.com), or file a GitHub Issue in this repository.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ install:
- pip install pypandoc
- pip install coverage
- pip install codecov
- pip install pycodestyle
# - sudo apt-get install -y pandoc
addons:
apt_packages:
Expand All @@ -30,6 +31,10 @@ before_script:
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
# errors W605 and W504 added to avoid inconsistent errors happening
# error W605 happening on validators.py:28:40 on a valid Regex
# error W504 happening on validators.py:54:29 on a valid line break operator
- pycodestyle --ignore=W605,W504 --exclude='build'
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then coverage run -m unittest2 discover; else coverage run -m unittest discover; fi
after_script:
- codecov
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
# Change Log
All notable changes to this project will be documented in this file.

## [5.6.0] - 2018-08-20 ##
### Added
- [PR #593](https://github.com/sendgrid/sendgrid-python/pull/593): Adds support for dynamic template data. Big thanks to [Slam](https://github.com/3lnc) for the PR! Also, big thanks to [Wojciech Bartosiak](https://github.com/wojtek-fliposports) for [PR #597](https://github.com/sendgrid/sendgrid-python/pull/597)!

## [5.5.0] - 2018-08-16 ##
### Added
- [PR #588](https://github.com/sendgrid/sendgrid-python/pull/588): Updates the Readme to include environment variable setup in windows. Big thanks to [Bhargav Chandaka](https://github.com/bchandaka) for the PR!
- [PR #599](https://github.com/sendgrid/sendgrid-python/pull/599): Updates the Readme to include additional API Key instruction. Big thanks to [Anshul Singhal](https://github.com/af4ro) for the PR!
- [PR #600](https://github.com/sendgrid/sendgrid-python/pull/600): Add CodeTriage Badge. Big thanks to [Anshul Singhal](https://github.com/af4ro) for the PR!
- [PR #601](https://github.com/sendgrid/sendgrid-python/pull/601): Readability improvements to CONTRIBUTING.md. Big thanks to [Anshul Singhal](https://github.com/af4ro) for the PR!
- [PR #604](https://github.com/sendgrid/sendgrid-python/pull/604): Readability improvements to CONTRIBUTING.md. Big thanks to [agnesjang98](https://github.com/agnesjang98) for the PR!

### Fixed
- [PR #595](https://github.com/sendgrid/sendgrid-python/pull/595): Change type of category in Mail.add_category from string to Category. Big thanks to [Phawin Khongkhasawan](https://github.com/lifez) for the PR!
- [PR #596](https://github.com/sendgrid/sendgrid-python/pull/596): Fix Docker build. Big thanks to [Phawin Khongkhasawan](https://github.com/lifez) for the PR!
- [PR #598](https://github.com/sendgrid/sendgrid-python/pull/598): Fix python3 print example in TROUBLESHOOTING.md. Big thanks to [Ryan Jarvis](https://github.com/Cabalist) for the PR!
- [PR #603](https://github.com/sendgrid/sendgrid-python/pull/603): Update TROUBLESHOOTING.md to link to correct use cases page. Big thanks to [James Purpura](https://github.com/jpurpura) for the PR!

## [5.4.1] - 2018-06-26 ##
### Fixed
- [PR #585](https://github.com/sendgrid/sendgrid-python/pull/585): Fix typo in `mail_example.py`. Big thanks to [Anurag Anand](https://github.com/theanuraganand) for the PR!
- [PR #583](https://github.com/sendgrid/sendgrid-python/pull/585): Fix `Personalization.substitutions` setter. Trying to set substitutions directly rather than with add_substitution was causing an infinite regress. Big thanks to [Richard Nias](https://github.com/richardnias) for the PR!
- [PR #583](https://github.com/sendgrid/sendgrid-python/pull/583): Fix `Personalization.substitutions` setter. Trying to set substitutions directly rather than with add_substitution was causing an infinite regress. Big thanks to [Richard Nias](https://github.com/richardnias) for the PR!

## [5.4.0] - 2018-06-07 ##
### Added
Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ A software bug is a demonstrable issue in the code base. In order for us to diag

Before you decide to create a new issue, please try the following:

1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
1. Check the GitHub issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
2. Update to the latest version of this code and check if issue has already been fixed
3. Copy and fill in the Bug Report Template we have provided below

Expand Down Expand Up @@ -191,8 +191,10 @@ Please run your code through:
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/sendgrid/sendgrid-python

# Navigate to the newly cloned directory
cd sendgrid-python

# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/sendgrid/sendgrid-python
```
Expand Down Expand Up @@ -240,4 +242,4 @@ If you have any additional questions, please feel free to [email](mailto:dx@send

<a name="code-reviews"></a>
## Code Reviews
If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, Github has some great [information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/).
If you can, please look at open PRs and review them. Give feedback and help us merge these PRs much faster! If you don't know how, GitHub has some great [information on how to review a Pull Request](https://help.github.com/articles/about-pull-request-reviews/).
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-python.svg)](https://github.com/sendgrid/sendgrid-python/graphs/contributors)
[![Open Source Helpers](https://www.codetriage.com/sendgrid/sendgrid-python/badges/users.svg)](https://www.codetriage.com/sendgrid/sendgrid-python)

**NEW:**

Expand Down Expand Up @@ -38,6 +39,7 @@ We appreciate your continued support, thank you!
* [License](#license)

<a name="installation"></a>

# Installation

## Prerequisites
Expand All @@ -46,19 +48,28 @@ We appreciate your continued support, thank you!
- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-python)

## Setup Environment Variables
### Mac

Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:
Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys) (more info [here](https://sendgrid.com/docs/User_Guide/Settings/api_keys.html)), for example:

```bash
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
```
SendGrid also supports local environment file `.env`. Copy or rename `.env_sample` into `.env` and update [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys) with your key.

Sendgrid also supports local environment file `.env`. Copy or rename `.env_sample` into `.env` and update [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys) with your key.
### Windows
Temporarily set the environment variable(accessible only during the current cli session):
```bash
set SENDGRID_API_KEY=YOUR_API_KEY
```
Permanently set the environment variable(accessible in all subsequent cli sessions):
```bash
setx SENDGRID_API_KEY "YOUR_API_KEY"
```

## Install Package

```bash
pip install sendgrid
```
Expand All @@ -67,6 +78,7 @@ pip install sendgrid

- [Python-HTTP-Client](https://github.com/sendgrid/python-http-client)


<a name="quick-start"></a>
# Quick Start

Expand All @@ -93,7 +105,7 @@ print(response.body)
print(response.headers)
```

The `Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-python/blob/master/examples/helpers/mail/mail_example.py#L16) is an example of how to add it.
The `Mail` constructor creates a [personalization object](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html) for you. [Here](https://github.com/sendgrid/sendgrid-python/blob/master/examples/helpers/mail_example.py#L16) is an example of how to add it.

### Without Mail Helper Class

Expand Down Expand Up @@ -180,7 +192,7 @@ Please see [our helper](https://github.com/sendgrid/sendgrid-python/tree/master/
<a name="announcements"></a>
# Announcements

Join an experienced and passionate team that focuses on making an impact. Opportunities abound to grow the product - and grow your career! Check out our [Data Platform Engineer role](http://grnh.se/wbx1701)
Join an experienced and passionate team that focuses on making an impact. [Opportunities abound](https://sendgrid.com/careers) to grow the product - and grow your career!

Please see our announcement regarding [breaking changes](https://github.com/sendgrid/sendgrid-python/issues/217). Your support is appreciated!

Expand All @@ -200,9 +212,9 @@ Quick links:

- [Feature Request](https://github.com/sendgrid/sendgrid-python/blob/master/CONTRIBUTING.md#feature-request)
- [Bug Reports](https://github.com/sendgrid/sendgrid-python/blob/master/CONTRIBUTING.md#submit-a-bug-report)
- [Sign the CLA to Create a Pull Request](https://cla.sendgrid.com/sendgrid/sendgrid-python)
- [Improvements to the Codebase](https://github.com/sendgrid/sendgrid-python/blob/master/CONTRIBUTING.md#improvements-to-the-codebase)
- [Review Pull Requests](https://github.com/sendgrid/sendgrid-python/blob/master/CONTRIBUTING.md#code-reviews)
- [Sign the CLA to Create a Pull Request](https://cla.sendgrid.com/sendgrid/sendgrid-python)

<a name="troubleshooting"></a>
# Troubleshooting
Expand All @@ -212,7 +224,9 @@ Please see our [troubleshooting guide](https://github.com/sendgrid/sendgrid-pyth
<a name="about"></a>
# About

sendgrid-python is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
sendgrid-python is guided and supported by the SendGrid Developer Experience Team.

Email the Developer Experience Team [here](mailto:dx@sendgrid.com) in case of any queries.

sendgrid-python is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-python are trademarks of SendGrid, Inc.

Expand Down
4 changes: 2 additions & 2 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import urllib
try:
response = sg.client.mail.send.post(request_body=mail.get())
except urllib.error.HTTPError as e:
print e.read()
print(e.read())
```

<a name="migrating"></a>
Expand Down Expand Up @@ -111,4 +111,4 @@ print mail.get()
<a name="error-handling"></a>
# Error Handling

Please review [our use_cases](https://github.com/sendgrid/sendgrid-python/use_cases/README.md) for examples of error handling.
Please review [our use_cases](https://github.com/sendgrid/sendgrid-python/blob/master/use_cases/README.md#use-cases) for examples of error handling.
2 changes: 1 addition & 1 deletion docker-test/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ fi

cd sendgrid-python
python3.6 setup.py install
pip install pyyaml six werkzeug flask
pip install pyyaml six werkzeug flask python-http-client pytest
exec $SHELL
12 changes: 8 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ FROM ubuntu:xenial
ENV PYTHON_VERSIONS='python2.6 python2.7 python3.4 python3.5 python3.6' \
OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"

ARG SENDGRID-PYTHON_VERSION
ARG BRANCH_HTTP_CLIENT

# install testing versions of python, including old versions, from deadsnakes
RUN set -x \
&& apt-get update \
Expand All @@ -25,19 +28,20 @@ RUN chmod +x ./install.sh && sync && \
# install pip, tox
ADD https://bootstrap.pypa.io/get-pip.py get-pip.py
RUN python2.7 get-pip.py && \
python3.6 get-pip.py && \
pip install tox && \
rm get-pip.py

#install pyyaml, six, werkzeug
RUN python3.6 -m pip install pyyaml
RUN python3.6 -m pip install six
RUN Python3.6 -m pip install werkzeug
RUN Python3.6 -m pip install flask
RUN python3.6 -m pip install werkzeug
RUN python3.6 -m pip install flask

# set up default sendgrid env
WORKDIR /root/sources
RUN git clone https://github.com/sendgrid/sendgrid-python.git && \
git clone https://github.com/sendgrid/python-http-client.git
RUN git clone https://github.com/sendgrid/sendgrid-python.git --branch $SENDGRID-PYTHON_VERSION && \
git clone https://github.com/sendgrid/python-http-client.git --branch $HTTP-CLIENT_VERSION
WORKDIR /root
RUN ln -s /root/sources/sendgrid-python/sendgrid && \
ln -s /root/sources/python-http-client/python_http_client
Expand Down
20 changes: 20 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
stop:
docker-compose stop

rm: stop
docker-compose stop -fvs

clean:
docker rmi %(docker images -aq)

clean_untagged:
docker rmi $(docker images --quiet --filter "dangling=true") 2>/dev/null

build:
docker-compose up -d

build-build:
docker-compose up --build -d

up: rm clean build-build
echo "Sendgrid-python environment is alive :D"
4 changes: 3 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Supported tags and respective `Dockerfile` links
- `v5.4.1`, `latest` [(Dockerfile)](https://github.com/sendgrid/sendgrid-python/blob/master/docker/Dockerfile)
- `v5.6.0`, `latest` [(Dockerfile)](https://github.com/sendgrid/sendgrid-python/blob/master/docker/Dockerfile)
- `v5.5.0`
- `v5.4.1`
- `v5.4.0`
- `v5.3.0`
- `v5.2.1`
Expand Down
57 changes: 57 additions & 0 deletions docker/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,63 @@ $ docker run -it -v /path/to/cool-sendgrid-python:/mnt/sendgrid-python sendgrid/

Note that the paths you specify in `-v` must be absolute.

# Docker Compose

<a name="Quickstart"></a>
# Quickstart

1. Install docker-compose on your machine.
2. Must copy sendgrid.env to .env file.
3. Edit .env file for yours versions and paths.
4. Must create env folder for clone yours repo.
5. Have fun! :D

## Using tag's for versions - DockerHub:

### Edit variable TAG on .env/env_sample file

```sh-session
$ sed -ie 's/TAG=latest/TAG=choice_a_version/g'
```
### Run service using tags

```sh-session
$ cd /path/to/sendgrid-python/docker
$ docker-compose up -d sendgrid
```

## Specifying specific versions:

### Edit variable TAG on .env/env_sample file

```sh-session
$ sed -ie 's/SENDGRID_PYTHON_VERSION=vy.x.z/SENDGRID_PYTHON_VERSION=vx.y.z/g'
$ sed -ie 's/HTTP_CLIENT_VERSION=vy.x.z/HTTP_CLIENT_VERSION=vx.y.z/g'
```

### Run service

```sh-session
$ cd /path/to/sendgrid-python/docker
$ docker-compose up -d sendgrid-dev
```

## Specifying your own fork:

### Edit variable TAG on .env/env_sample file

```sh-session
$ sed -ie 's/TAG=latest/TAG=choice_a_version/g'
$ sed -ie 's/SENDGRID_PYTHON_VERSION=vy.x.z/SENDGRID_PYTHON_VERSION=vx.y.z/g'
```

### Run service

```sh-session
$ cd /path/to/sendgrid-python/docker
$ docker-compose up -d sendgrid-beta
```

<a name="Testing"></a>
# Testing
Testing is easy! Run the container, `cd sendgrid`, and run `tox`.
Expand Down
35 changes: 35 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.3"

services:
sendgrid:
image: sendgrid/sendgrid-python:${TAG}
restart: unless-stopped
container_name: sendgrid-prod
tty: true
env_file:
- .env

sendgrid-dev:
build:
context: .
args:
- SENDGRID-PYTHON_VERSION=${SENDGRID_PYTHON_VERSION}
- HTTP-CLIENT_VERSION=${HTTP_CLIENT_VERSION}
restart: unless-stopped
container_name: sendgrid-dev
tty: true
env_file:
- .env
volumes:
- ${PATH_TO_SENDGRID_PYTHON_DEV}:/mnt/sendgrid-python
- ${PATH_TO_HTTP_CLIENT_DEV}:/mnt/python-http-client

sendgrid-beta:
image: sendgrid/sendgrid-python:${TAG}
restart: unless-stopped
container_name: sendgrid-beta
tty: true
env_file:
- .env
volumes:
- ${PATH_TO_SENDGRID_PYTHON_FORK}:/root/sources/sendgrid-python/sendgrid
1 change: 1 addition & 0 deletions docker/env/python-dev/sendgrid-python
Submodule sendgrid-python added at 28cf42
8 changes: 8 additions & 0 deletions docker/sendgrid.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TAG=latest
SENDGRID_PYTHON_VERSION="v3.6.1"
HTTP_CLIENT_VERSION="v1.2.4"
PATH_TO_SENDGRID_PYTHON_DEV=../env/python-dev/sendgrid-python
PATH_TO_HTTP_CLIENT_DEV=../env/python-dev/python-http-client
PATH_TO_SENDGRID_PYTHON_PROD=../env/python-prod/sendgrid-python
PATH_TO_HTTP_CLIENT_PROD=../env/python-prod/python-http-client
PATH_TO_SENDGRID_PYTHON_FORK=../env/python-fork/sendgrid-python
6 changes: 4 additions & 2 deletions examples/campaigns/campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"spring line"
],
"custom_unsubscribe_url": "",
"html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>",
"html_content": "<html><head><title></title></head><body><p>Check out our "
"spring line!</p></body></html>",
"ip_pool": "marketing",
"list_ids": [
110,
Expand Down Expand Up @@ -52,7 +53,8 @@
"categories": [
"summer line"
],
"html_content": "<html><head><title></title></head><body><p>Check out our summer line!</p></body></html>",
"html_content": "<html><head><title></title></head><body><p>Check out our "
"summer line!</p></body></html>",
"plain_content": "Check out our summer line!",
"subject": "New Products for Summer!",
"title": "May Newsletter"
Expand Down