Skip to content

Commit 23817d2

Browse files
2 parents 0bf92db + 542ef48 commit 23817d2

File tree

39 files changed

+688
-561
lines changed

39 files changed

+688
-561
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Hello! Thank you for choosing to help contribute to one of the SendGrid open sou
1212
- [Code Reviews](#code-reviews)
1313

1414
<a name="roadmap"></a>
15-
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 review, comments, suggestions and additional PRs are welcomed and encouraged.
15+
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.
1616

1717
<a name="cla"></a>
1818
## CLAs and CCLAs
@@ -60,11 +60,13 @@ In order to make the process easier, we've included a [sample bug report templat
6060
We welcome direct contributions to the sendgrid-python code base. Thank you!
6161

6262
### Development Environment ###
63-
64-
#### Using Docker ####
63+
#### There are two ways to get set up: ####
64+
#### 1. Using Docker ####
65+
This is usually the easiest and fastest way to get set up.
6566
You can use our Docker image to avoid setting up the development environment yourself. See [USAGE.md](https://github.com/sendgrid/sendgrid-python/blob/master/docker/USAGE.md).
6667

67-
#### Install and Run Locally ####
68+
#### - OR - ####
69+
#### 2. Install and Run Locally ####
6870

6971
##### Prerequisites #####
7072

@@ -114,7 +116,7 @@ The Web API v3 client is `sendgrid.py`, the other files are legacy code for our
114116
<a name="testing"></a>
115117
## Testing
116118

117-
All PRs require passing tests before the PR will be reviewed.
119+
The PR must pass all the tests before it is reviewed.
118120

119121
All test files are in the [`test`](https://github.com/sendgrid/sendgrid-python/test) directory.
120122

@@ -130,7 +132,7 @@ For Python 2.7.* and up:
130132

131133
### Testing Multiple Versions of Python
132134

133-
All PRs require passing tests before the PR will be reviewed.
135+
The PR must pass all the tests before it is reviewed.
134136

135137
#### Prerequisites: ####
136138

@@ -140,7 +142,7 @@ The above local "Initial setup" is complete
140142
* [tox](https://pypi.python.org/pypi/tox)
141143
* [prism](https://github.com/stoplightio/prism) v0.6 - It should be available in your PATH, but unittest script
142144
will try to install it locally if not found. Apart from PATH env variable it will check in `~/bin` and `/usr/local/bin`.
143-
You can install by yourself it in user dir by calling `source test/prism.sh`.
145+
You can install it by yourself in user dir by calling `source test/prism.sh`.
144146

145147
#### Initial setup: ####
146148

@@ -151,8 +153,13 @@ pyenv install 2.6.9
151153
pyenv install 2.7.11
152154
pyenv install 3.4.3
153155
pyenv install 3.5.0
156+
```
157+
Make sure to change the current working directory to your local version of the repo before running the following command:
158+
```
154159
python setup.py install
155-
pyenv local 3.5.0 3.4.3 2.7.8 2.6.9
160+
```
161+
```
162+
pyenv local 3.5.0 3.4.3 2.7.11 2.6.9
156163
pyenv rehash
157164
```
158165

USAGE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ print response.headers
434434

435435
**This endpoint allows you to create a new suppression group.**
436436

437-
Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
437+
Suppression groups, or unsubscribe groups, are specific types or categories of emails that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
438438

439439
The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
440440

@@ -478,7 +478,7 @@ print response.headers
478478

479479
**This endpoint allows you to update or change a suppression group.**
480480

481-
Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
481+
Suppression groups, or unsubscribe groups, are specific types or categories of emails that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
482482

483483
The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
484484

@@ -503,7 +503,7 @@ print response.headers
503503

504504
**This endpoint allows you to retrieve a single suppression group.**
505505

506-
Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
506+
Suppression groups, or unsubscribe groups, are specific types or categories of emails that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
507507

508508
The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
509509

@@ -525,7 +525,7 @@ print response.headers
525525

526526
You can only delete groups that have not been attached to sent mail in the last 60 days. If a recipient uses the "one-click unsubscribe" option on an email associated with a deleted group, that recipient will be added to the global suppression list.
527527

528-
Suppression groups, or unsubscribe groups, are specific types or categories of email that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
528+
Suppression groups, or unsubscribe groups, are specific types or categories of emails that you would like your recipients to be able to unsubscribe from. For example: Daily Newsletters, Invoices, System Alerts.
529529

530530
The **name** and **description** of the unsubscribe group will be visible by recipients when they are managing their subscriptions.
531531

examples/accesssettings/accesssettings.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
# POST /access_settings/whitelist #
2121

2222
data = {
23-
"ips": [
24-
{
25-
"ip": "192.168.1.1"
26-
},
27-
{
28-
"ip": "192.*.*.*"
29-
},
30-
{
31-
"ip": "192.168.1.3/32"
32-
}
33-
]
23+
"ips": [
24+
{
25+
"ip": "192.168.1.1"
26+
},
27+
{
28+
"ip": "192.*.*.*"
29+
},
30+
{
31+
"ip": "192.168.1.3/32"
32+
}
33+
]
3434
}
3535
response = sg.client.access_settings.whitelist.post(request_body=data)
3636
print(response.status_code)
@@ -51,11 +51,11 @@
5151
# DELETE /access_settings/whitelist #
5252

5353
data = {
54-
"ids": [
55-
1,
56-
2,
57-
3
58-
]
54+
"ids": [
55+
1,
56+
2,
57+
3
58+
]
5959
}
6060
response = sg.client.access_settings.whitelist.delete(request_body=data)
6161
print(response.status_code)
@@ -81,4 +81,3 @@
8181
print(response.status_code)
8282
print(response.body)
8383
print(response.headers)
84-

examples/alerts/alerts.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# POST /alerts #
1111

1212
data = {
13-
"email_to": "example@example.com",
14-
"frequency": "daily",
15-
"type": "stats_notification"
13+
"email_to": "example@example.com",
14+
"frequency": "daily",
15+
"type": "stats_notification"
1616
}
1717
response = sg.client.alerts.post(request_body=data)
1818
print(response.status_code)
@@ -33,7 +33,7 @@
3333
# PATCH /alerts/{alert_id} #
3434

3535
data = {
36-
"email_to": "example@example.com"
36+
"email_to": "example@example.com"
3737
}
3838
alert_id = "test_url_param"
3939
response = sg.client.alerts._(alert_id).patch(request_body=data)
@@ -60,4 +60,3 @@
6060
print(response.status_code)
6161
print(response.body)
6262
print(response.headers)
63-

examples/apikeys/apikeys.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
# POST /api_keys #
1111

1212
data = {
13-
"name": "My API Key",
14-
"sample": "data",
15-
"scopes": [
16-
"mail.send",
17-
"alerts.create",
18-
"alerts.read"
19-
]
13+
"name": "My API Key",
14+
"sample": "data",
15+
"scopes": [
16+
"mail.send",
17+
"alerts.create",
18+
"alerts.read"
19+
]
2020
}
2121
response = sg.client.api_keys.post(request_body=data)
2222
print(response.status_code)
@@ -38,11 +38,11 @@
3838
# PUT /api_keys/{api_key_id} #
3939

4040
data = {
41-
"name": "A New Hope",
42-
"scopes": [
43-
"user.profile.read",
44-
"user.profile.update"
45-
]
41+
"name": "A New Hope",
42+
"scopes": [
43+
"user.profile.read",
44+
"user.profile.update"
45+
]
4646
}
4747
api_key_id = "test_url_param"
4848
response = sg.client.api_keys._(api_key_id).put(request_body=data)
@@ -55,7 +55,7 @@
5555
# PATCH /api_keys/{api_key_id} #
5656

5757
data = {
58-
"name": "A New Hope"
58+
"name": "A New Hope"
5959
}
6060
api_key_id = "test_url_param"
6161
response = sg.client.api_keys._(api_key_id).patch(request_body=data)
@@ -82,4 +82,3 @@
8282
print(response.status_code)
8383
print(response.body)
8484
print(response.headers)
85-

examples/asm/asm.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# POST /asm/groups #
1111

1212
data = {
13-
"description": "Suggestions for products our users might like.",
14-
"is_default": True,
15-
"name": "Product Suggestions"
13+
"description": "Suggestions for products our users might like.",
14+
"is_default": True,
15+
"name": "Product Suggestions"
1616
}
1717
response = sg.client.asm.groups.post(request_body=data)
1818
print(response.status_code)
@@ -34,9 +34,9 @@
3434
# PATCH /asm/groups/{group_id} #
3535

3636
data = {
37-
"description": "Suggestions for items our users might like.",
38-
"id": 103,
39-
"name": "Item Suggestions"
37+
"description": "Suggestions for items our users might like.",
38+
"id": 103,
39+
"name": "Item Suggestions"
4040
}
4141
group_id = "test_url_param"
4242
response = sg.client.asm.groups._(group_id).patch(request_body=data)
@@ -69,13 +69,14 @@
6969
# POST /asm/groups/{group_id}/suppressions #
7070

7171
data = {
72-
"recipient_emails": [
73-
"test1@example.com",
74-
"test2@example.com"
75-
]
72+
"recipient_emails": [
73+
"test1@example.com",
74+
"test2@example.com"
75+
]
7676
}
7777
group_id = "test_url_param"
78-
response = sg.client.asm.groups._(group_id).suppressions.post(request_body=data)
78+
response = sg.client.asm.groups._(
79+
group_id).suppressions.post(request_body=data)
7980
print(response.status_code)
8081
print(response.body)
8182
print(response.headers)
@@ -95,14 +96,15 @@
9596
# POST /asm/groups/{group_id}/suppressions/search #
9697

9798
data = {
98-
"recipient_emails": [
99-
"exists1@example.com",
100-
"exists2@example.com",
101-
"doesnotexists@example.com"
102-
]
99+
"recipient_emails": [
100+
"exists1@example.com",
101+
"exists2@example.com",
102+
"doesnotexists@example.com"
103+
]
103104
}
104105
group_id = "test_url_param"
105-
response = sg.client.asm.groups._(group_id).suppressions.search.post(request_body=data)
106+
response = sg.client.asm.groups._(
107+
group_id).suppressions.search.post(request_body=data)
106108
print(response.status_code)
107109
print(response.body)
108110
print(response.headers)
@@ -132,10 +134,10 @@
132134
# POST /asm/suppressions/global #
133135

134136
data = {
135-
"recipient_emails": [
136-
"test1@example.com",
137-
"test2@example.com"
138-
]
137+
"recipient_emails": [
138+
"test1@example.com",
139+
"test2@example.com"
140+
]
139141
}
140142
response = sg.client.asm.suppressions._("global").post(request_body=data)
141143
print(response.status_code)
@@ -171,4 +173,3 @@
171173
print(response.status_code)
172174
print(response.body)
173175
print(response.headers)
174-

examples/browsers/browsers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
# Retrieve email statistics by browser. #
1010
# GET /browsers/stats #
1111

12-
params = {'end_date': '2016-04-01', 'aggregated_by': 'day', 'browsers': 'test_string', 'limit': 'test_string', 'offset': 'test_string', 'start_date': '2016-01-01'}
12+
params = {'end_date': '2016-04-01',
13+
'aggregated_by': 'day',
14+
'browsers': 'test_string',
15+
'limit': 'test_string',
16+
'offset': 'test_string',
17+
'start_date': '2016-01-01'}
1318
response = sg.client.browsers.stats.get(query_params=params)
1419
print(response.status_code)
1520
print(response.body)
1621
print(response.headers)
17-

0 commit comments

Comments
 (0)