Skip to content

Commit 62ba6f1

Browse files
Fixing merge conflicts
2 parents ae4b1fe + 265b984 commit 62ba6f1

24 files changed

+382
-70
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ All notable changes to this project will be documented in this file.
1515
## [5.4.1] - 2018-06-26 ##
1616
### Fixed
1717
- [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!
18-
- [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!
18+
- [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!
1919

2020
## [5.4.0] - 2018-06-07 ##
2121
### Added
@@ -54,7 +54,7 @@ All notable changes to this project will be documented in this file.
5454
- [PR #430](https://github.com/sendgrid/sendgrid-python/pull/430): Attempt to sync before executing the shell command. Big thanks to [Aditya Narayan](https://github.com/aditnryn) for the PR!
5555
- [PR #429](https://github.com/sendgrid/sendgrid-python/pull/429): Typos. Big thanks to [daluntw](https://github.com/daluntw) for the PR!
5656
- [PR #492](https://github.com/sendgrid/sendgrid-python/pull/492):
57-
Updated date-range in LICENSE file. Big thanks to [Dhruv Srivastava](https://github.com/dhruvhacks) for the PR!
57+
Updated date-range in the LICENSE file. Big thanks to [Dhruv Srivastava](https://github.com/dhruvhacks) for the PR!
5858
- [PR #482](https://github.com/sendgrid/sendgrid-python/pull/482): Typos. Big thanks to [Karan Samani](https://github.com/Kimi450) for the PR!
5959
- [PR #504](https://github.com/sendgrid/sendgrid-python/pull/504): Fix .codeclimate.yml. Big thanks to [Matt Bernier](https://github.com/mbernier) for the PR!
6060
- [PR #505](https://github.com/sendgrid/sendgrid-python/pull/505): Remove unnecessary GitHub PR templates. Big thanks to [Alex](https://github.com/pushkyn) for the PR!

CODE_OF_CONDUCT.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@
44

55
### Be Open
66
Members of the community are open to collaboration, whether it's on pull requests, code reviews, approvals, issues or otherwise. We're receptive to constructive comments and criticism, as the experiences and skill sets of all members contribute to the whole of our efforts. We're accepting of all who wish to take part in our activities, fostering an environment where anyone can participate, and everyone can make a difference.
7-
7+
88
### Be Considerate
99
Members of the community are considerate of their peers, which include other contributors and users of SendGrid. We're thoughtful when addressing the efforts of others, keeping in mind that often the labor was completed with the intent of the good of the community. We're attentive in our communications, whether in person or online, and we're tactful when approaching differing views.
10-
10+
1111
### Be Respectful
12-
Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments and their efforts. We're respectful of the volunteer efforts that permeate the SendGrid community. We're respectful of the processes outlined in the community, and we work within them. When we disagree, we are courteous in raising our issues. Overall, we're good to each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.
13-
14-
## Additional Guidance
15-
12+
Members of the community are respectful. We're respectful of others, their positions, their skills, their commitments, and their efforts. We're respectful of the volunteer efforts that permeate the SendGrid community. We're respectful of the processes outlined in the community, and we work within them. When we disagree, we are courteous in raising our issues. Overall, we're good with each other. We contribute to this community not because we have to, but because we want to. If we remember that, these guidelines will come naturally.
13+
14+
## Additional Guidance
15+
1616
### Disclose Potential Conflicts of Interest
1717
Community discussions often involve interested parties. We expect participants to be aware when they are conflicted due to employment or other projects they are involved in and disclose those interests to other project members. When in doubt, over-disclose. Perceived conflicts of interest are important to address so that the community’s decisions are credible even when unpopular, difficult or favorable to the interests of one group over another.
18-
18+
1919
### Interpretation
2020
This Code is not exhaustive or complete. It is not a rulebook; it serves to distill our common understanding of a collaborative, shared environment and goals. We expect it to be followed in spirit as much as in the letter. When in doubt, try to abide by [SendGrid’s cultural values](https://sendgrid.com/blog/employee-engagement-the-4h-way) defined by our “4H’s”: Happy, Hungry, Humble and Honest.
2121

2222
### Enforcement
2323
Most members of the SendGrid community always comply with this Code, not because of the existence of this Code, but because they have long experience participating in open source communities where the conduct described above is normal and expected. However, failure to observe this Code may be grounds for suspension, reporting the user for abuse or changing permissions for outside contributors.
24-
24+
2525
## If you have concerns about someone’s conduct
2626
**Initiate Direct Contact** - It is always appropriate to email a community member (if contact information is available), mention that you think their behavior was out of line, and (if necessary) point them to this Code.
27-
27+
2828
**Discuss Publicly** - Discussing publicly is always acceptable. Note, though, that approaching the person directly may be better, as it tends to make them less defensive, and it respects the time of other community members, so you probably want to try direct contact first.
29-
29+
3030
**Contact the Moderators** - You can reach the SendGrid moderators by emailing dx@sendgrid.com.
31-
31+
3232
## Submission to SendGrid Repositories
3333
Finally, just a reminder, changes to the SendGrid repositories will only be accepted upon completion of the [SendGrid Contributor Agreement](https://cla.sendgrid.com).
3434

3535
## Attribution
36-
36+
3737
SendGrid thanks the following, on which it draws for content and inspiration:
3838

3939
* [Python Community Code of Conduct](https://www.python.org/psf/codeofconduct)

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou
2525
- [Code Reviews](#code-reviews)
2626

2727
<a name="roadmap"></a>
28-
We use [Milestones](https://github.com/sendgrid/sendgrid-python/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community reviews, comments, suggestions and additional PRs are welcomed and encouraged.
28+
We use [Milestones](https://github.com/sendgrid/sendgrid-python/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community reviews, comments, suggestions, and additional PRs are welcomed and encouraged.
2929

3030
<a name="cla"></a>
3131
## CLAs and CCLAs
3232

3333
Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project.
3434

35-
Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
35+
Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way, the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
3636

3737
SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid_cla).
3838

@@ -217,7 +217,7 @@ Please run your code through:
217217
git pull upstream <dev-branch>
218218
```
219219

220-
3. Create a new topic branch (off the main project development branch) to
220+
3. Create a new topic branch (of the main project development branch) to
221221
contain your feature, change, or fix:
222222

223223
```bash

USAGE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5034,4 +5034,3 @@ print(response.status_code)
50345034
print(response.body)
50355035
print(response.headers)
50365036
```
5037-

docker-test/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@ fi
1313

1414
cd sendgrid-python
1515
python3.6 setup.py install
16+
<<<<<<< HEAD
1617
pip install pyyaml six werkzeug flask python_http_client
18+
=======
19+
pip install pyyaml six werkzeug flask python-http-client pytest
20+
>>>>>>> master
1721
exec $SHELL

docker/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Supported tags and respective `Dockerfile` links
2-
- `v5.4.1`, `latest` [(Dockerfile)](https://github.com/sendgrid/sendgrid-python/blob/master/docker/Dockerfile)
2+
- `v5.6.0`, `latest` [(Dockerfile)](https://github.com/sendgrid/sendgrid-python/blob/master/docker/Dockerfile)
3+
- `v5.5.0`
4+
- `v5.4.1`
35
- `v5.4.0`
46
- `v5.3.0`
57
- `v5.2.1`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 28cf42f6d590695de7e7ecdedcb67e9d8d4729ac
Lines changed: 115 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import json
2-
import os
3-
import urllib2
1+
from sendgrid import SendGridAPIClient
42
from sendgrid.helpers.mail import *
5-
from sendgrid import *
3+
64

75
# NOTE: you will need move this file to the root
86
# directory of this project to execute properly.
@@ -28,6 +26,84 @@ def build_hello_email():
2826
except SendGridException as e:
2927
print(e.message)
3028

29+
<<<<<<< HEAD:examples/helpers/mail/mail_example.py
30+
=======
31+
for cc_addr in personalization['cc_list']:
32+
mock_personalization.add_to(cc_addr)
33+
34+
for bcc_addr in personalization['bcc_list']:
35+
mock_personalization.add_bcc(bcc_addr)
36+
37+
for header in personalization['headers']:
38+
mock_personalization.add_header(header)
39+
40+
for substitution in personalization['substitutions']:
41+
mock_personalization.add_substitution(substitution)
42+
43+
for arg in personalization['custom_args']:
44+
mock_personalization.add_custom_arg(arg)
45+
46+
mock_personalization.subject = personalization['subject']
47+
mock_personalization.send_at = personalization['send_at']
48+
return mock_personalization
49+
50+
51+
def get_mock_personalization_dict():
52+
"""Get a dict of personalization mock."""
53+
mock_pers = dict()
54+
55+
mock_pers['to_list'] = [Email("test1@example.com",
56+
"Example User"),
57+
Email("test2@example.com",
58+
"Example User")]
59+
60+
mock_pers['cc_list'] = [Email("test3@example.com",
61+
"Example User"),
62+
Email("test4@example.com",
63+
"Example User")]
64+
65+
mock_pers['bcc_list'] = [Email("test5@example.com"),
66+
Email("test6@example.com")]
67+
68+
mock_pers['subject'] = ("Hello World from the Personalized "
69+
"SendGrid Python Library")
70+
71+
mock_pers['headers'] = [Header("X-Test", "test"),
72+
Header("X-Mock", "true")]
73+
74+
mock_pers['substitutions'] = [Substitution("%name%", "Example User"),
75+
Substitution("%city%", "Denver")]
76+
77+
mock_pers['custom_args'] = [CustomArg("user_id", "343"),
78+
CustomArg("type", "marketing")]
79+
80+
mock_pers['send_at'] = 1443636843
81+
return mock_pers
82+
83+
84+
def build_attachment1():
85+
"""Build attachment mock. Make sure your content is base64 encoded before passing into attachment.content.
86+
Another example: https://github.com/sendgrid/sendgrid-python/blob/master/use_cases/attachment.md"""
87+
attachment = Attachment()
88+
attachment.content = ("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNl"
89+
"Y3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12")
90+
attachment.type = "application/pdf"
91+
attachment.filename = "balance_001.pdf"
92+
attachment.disposition = "attachment"
93+
attachment.content_id = "Balance Sheet"
94+
return attachment
95+
96+
97+
def build_attachment2():
98+
"""Build attachment mock."""
99+
attachment = Attachment()
100+
attachment.content = "BwdW"
101+
attachment.type = "image/png"
102+
attachment.filename = "banner.png"
103+
attachment.disposition = "inline"
104+
attachment.content_id = "Banner"
105+
return attachment
106+
>>>>>>> master:examples/helpers/mail_example.py
31107

32108
def build_kitchen_sink():
33109
"""All settings set"""
@@ -261,5 +337,40 @@ def send_kitchen_sink():
261337
## this will actually send an email
262338
# send_hello_email()
263339

340+
<<<<<<< HEAD:examples/helpers/mail/mail_example.py
264341
## this will only send an email if you set SandBox Mode to False
265342
# send_kitchen_sink()
343+
=======
344+
# this will only send an email if you set SandBox Mode to False
345+
send_kitchen_sink()
346+
347+
348+
def transactional_template_usage():
349+
# Assumes you set your environment variable:
350+
# https://github.com/sendgrid/sendgrid-python/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key
351+
352+
"""
353+
Sample usage of dynamic (handlebars) transactional templates.
354+
To make this work, you should have dynamic template created within your
355+
SendGrid account. For this particular example, template may be like::
356+
357+
<p>Hello, {{name}}! Your current balance is {{balance}}<p>
358+
359+
"""
360+
mail = Mail()
361+
mail.from_email = Email('templates@sendgrid.com')
362+
mail.template_id = 'd-your-dynamic-template-uid'
363+
p = Personalization()
364+
p.add_to(Email('user@example.com'))
365+
p.dynamic_template_data = {
366+
'name': 'Bob',
367+
'balance': 42
368+
}
369+
mail.add_personalization(p)
370+
371+
sg = SendGridAPIClient()
372+
response = sg.client.mail.send.post(request_body=mail.get())
373+
print(response.status_code)
374+
print(response.headers)
375+
print(response.body)
376+
>>>>>>> master:examples/helpers/mail_example.py
File renamed without changes.

sendgrid/helpers/mail/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Please complete the [installation steps](https://github.com/sendgrid/sendgrid-py
77
## Usage
88

99
- For the most common use cases, please see [these examples](https://github.com/sendgrid/sendgrid-python/tree/master/use_cases)
10-
-The comple v3 API Documentation can be found [here](https://sendgrid.com/docs/API_Reference/api_v3.html)
10+
-The comple v3 API Documentation can be found [here](https://sendgrid.com/docs/API_Reference/api_v3.html)

0 commit comments

Comments
 (0)