Skip to content

Commit

Permalink
Merge pull request #466 from blackpioter/master
Browse files Browse the repository at this point in the history
Fixed PEP8 issues except E501.
  • Loading branch information
thinkingserious authored May 30, 2018
2 parents 0007d66 + 29717f3 commit 52f86b7
Show file tree
Hide file tree
Showing 33 changed files with 577 additions and 521 deletions.
33 changes: 16 additions & 17 deletions examples/accesssettings/accesssettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
# POST /access_settings/whitelist #

data = {
"ips": [
{
"ip": "192.168.1.1"
},
{
"ip": "192.*.*.*"
},
{
"ip": "192.168.1.3/32"
}
]
"ips": [
{
"ip": "192.168.1.1"
},
{
"ip": "192.*.*.*"
},
{
"ip": "192.168.1.3/32"
}
]
}
response = sg.client.access_settings.whitelist.post(request_body=data)
print(response.status_code)
Expand All @@ -51,11 +51,11 @@
# DELETE /access_settings/whitelist #

data = {
"ids": [
1,
2,
3
]
"ids": [
1,
2,
3
]
}
response = sg.client.access_settings.whitelist.delete(request_body=data)
print(response.status_code)
Expand All @@ -81,4 +81,3 @@
print(response.status_code)
print(response.body)
print(response.headers)

9 changes: 4 additions & 5 deletions examples/alerts/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# POST /alerts #

data = {
"email_to": "[email protected]",
"frequency": "daily",
"type": "stats_notification"
"email_to": "[email protected]",
"frequency": "daily",
"type": "stats_notification"
}
response = sg.client.alerts.post(request_body=data)
print(response.status_code)
Expand All @@ -33,7 +33,7 @@
# PATCH /alerts/{alert_id} #

data = {
"email_to": "[email protected]"
"email_to": "[email protected]"
}
alert_id = "test_url_param"
response = sg.client.alerts._(alert_id).patch(request_body=data)
Expand All @@ -60,4 +60,3 @@
print(response.status_code)
print(response.body)
print(response.headers)

27 changes: 13 additions & 14 deletions examples/apikeys/apikeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
# POST /api_keys #

data = {
"name": "My API Key",
"sample": "data",
"scopes": [
"mail.send",
"alerts.create",
"alerts.read"
]
"name": "My API Key",
"sample": "data",
"scopes": [
"mail.send",
"alerts.create",
"alerts.read"
]
}
response = sg.client.api_keys.post(request_body=data)
print(response.status_code)
Expand All @@ -38,11 +38,11 @@
# PUT /api_keys/{api_key_id} #

data = {
"name": "A New Hope",
"scopes": [
"user.profile.read",
"user.profile.update"
]
"name": "A New Hope",
"scopes": [
"user.profile.read",
"user.profile.update"
]
}
api_key_id = "test_url_param"
response = sg.client.api_keys._(api_key_id).put(request_body=data)
Expand All @@ -55,7 +55,7 @@
# PATCH /api_keys/{api_key_id} #

data = {
"name": "A New Hope"
"name": "A New Hope"
}
api_key_id = "test_url_param"
response = sg.client.api_keys._(api_key_id).patch(request_body=data)
Expand All @@ -82,4 +82,3 @@
print(response.status_code)
print(response.body)
print(response.headers)

45 changes: 23 additions & 22 deletions examples/asm/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# POST /asm/groups #

data = {
"description": "Suggestions for products our users might like.",
"is_default": True,
"name": "Product Suggestions"
"description": "Suggestions for products our users might like.",
"is_default": True,
"name": "Product Suggestions"
}
response = sg.client.asm.groups.post(request_body=data)
print(response.status_code)
Expand All @@ -34,9 +34,9 @@
# PATCH /asm/groups/{group_id} #

data = {
"description": "Suggestions for items our users might like.",
"id": 103,
"name": "Item Suggestions"
"description": "Suggestions for items our users might like.",
"id": 103,
"name": "Item Suggestions"
}
group_id = "test_url_param"
response = sg.client.asm.groups._(group_id).patch(request_body=data)
Expand Down Expand Up @@ -69,13 +69,14 @@
# POST /asm/groups/{group_id}/suppressions #

data = {
"recipient_emails": [
"[email protected]",
"[email protected]"
]
"recipient_emails": [
"[email protected]",
"[email protected]"
]
}
group_id = "test_url_param"
response = sg.client.asm.groups._(group_id).suppressions.post(request_body=data)
response = sg.client.asm.groups._(
group_id).suppressions.post(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)
Expand All @@ -95,14 +96,15 @@
# POST /asm/groups/{group_id}/suppressions/search #

data = {
"recipient_emails": [
"[email protected]",
"[email protected]",
"[email protected]"
]
"recipient_emails": [
"[email protected]",
"[email protected]",
"[email protected]"
]
}
group_id = "test_url_param"
response = sg.client.asm.groups._(group_id).suppressions.search.post(request_body=data)
response = sg.client.asm.groups._(
group_id).suppressions.search.post(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)
Expand Down Expand Up @@ -132,10 +134,10 @@
# POST /asm/suppressions/global #

data = {
"recipient_emails": [
"[email protected]",
"[email protected]"
]
"recipient_emails": [
"[email protected]",
"[email protected]"
]
}
response = sg.client.asm.suppressions._("global").post(request_body=data)
print(response.status_code)
Expand Down Expand Up @@ -171,4 +173,3 @@
print(response.status_code)
print(response.body)
print(response.headers)

8 changes: 6 additions & 2 deletions examples/browsers/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
# Retrieve email statistics by browser. #
# GET /browsers/stats #

params = {'end_date': '2016-04-01', 'aggregated_by': 'day', 'browsers': 'test_string', 'limit': 'test_string', 'offset': 'test_string', 'start_date': '2016-01-01'}
params = {'end_date': '2016-04-01',
'aggregated_by': 'day',
'browsers': 'test_string',
'limit': 'test_string',
'offset': 'test_string',
'start_date': '2016-01-01'}
response = sg.client.browsers.stats.get(query_params=params)
print(response.status_code)
print(response.body)
print(response.headers)

63 changes: 32 additions & 31 deletions examples/campaigns/campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
# POST /campaigns #

data = {
"categories": [
"spring line"
],
"custom_unsubscribe_url": "",
"html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>",
"ip_pool": "marketing",
"list_ids": [
110,
124
],
"plain_content": "Check out our spring line!",
"segment_ids": [
110
],
"sender_id": 124451,
"subject": "New Products for Spring!",
"suppression_group_id": 42,
"title": "March Newsletter"
"categories": [
"spring line"
],
"custom_unsubscribe_url": "",
"html_content": "<html><head><title></title></head><body><p>Check out our spring line!</p></body></html>",
"ip_pool": "marketing",
"list_ids": [
110,
124
],
"plain_content": "Check out our spring line!",
"segment_ids": [
110
],
"sender_id": 124451,
"subject": "New Products for Spring!",
"suppression_group_id": 42,
"title": "March Newsletter"
}
response = sg.client.campaigns.post(request_body=data)
print(response.status_code)
Expand All @@ -49,13 +49,13 @@
# PATCH /campaigns/{campaign_id} #

data = {
"categories": [
"summer line"
],
"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"
"categories": [
"summer line"
],
"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"
}
campaign_id = "test_url_param"
response = sg.client.campaigns._(campaign_id).patch(request_body=data)
Expand Down Expand Up @@ -88,10 +88,11 @@
# PATCH /campaigns/{campaign_id}/schedules #

data = {
"send_at": 1489451436
"send_at": 1489451436
}
campaign_id = "test_url_param"
response = sg.client.campaigns._(campaign_id).schedules.patch(request_body=data)
response = sg.client.campaigns._(
campaign_id).schedules.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)
Expand All @@ -101,7 +102,7 @@
# POST /campaigns/{campaign_id}/schedules #

data = {
"send_at": 1489771528
"send_at": 1489771528
}
campaign_id = "test_url_param"
response = sg.client.campaigns._(campaign_id).schedules.post(request_body=data)
Expand Down Expand Up @@ -144,11 +145,11 @@
# POST /campaigns/{campaign_id}/schedules/test #

data = {
"to": "[email protected]"
"to": "[email protected]"
}
campaign_id = "test_url_param"
response = sg.client.campaigns._(campaign_id).schedules.test.post(request_body=data)
response = sg.client.campaigns._(
campaign_id).schedules.test.post(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

12 changes: 9 additions & 3 deletions examples/categories/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# Retrieve Email Statistics for Categories #
# GET /categories/stats #

params = {'end_date': '2016-04-01', 'aggregated_by': 'day', 'limit': 1, 'offset': 1, 'start_date': '2016-01-01', 'categories': 'test_string'}
params = {'end_date': '2016-04-01', 'aggregated_by': 'day', 'limit': 1,
'offset': 1, 'start_date': '2016-01-01', 'categories': 'test_string'}
response = sg.client.categories.stats.get(query_params=params)
print(response.status_code)
print(response.body)
Expand All @@ -29,9 +30,14 @@
# Retrieve sums of email stats for each category [Needs: Stats object defined, has category ID?] #
# GET /categories/stats/sums #

params = {'end_date': '2016-04-01', 'aggregated_by': 'day', 'limit': 1, 'sort_by_metric': 'test_string', 'offset': 1, 'start_date': '2016-01-01', 'sort_by_direction': 'asc'}
params = {'end_date': '2016-04-01',
'aggregated_by': 'day',
'limit': 1,
'sort_by_metric': 'test_string',
'offset': 1,
'start_date': '2016-01-01',
'sort_by_direction': 'asc'}
response = sg.client.categories.stats.sums.get(query_params=params)
print(response.status_code)
print(response.body)
print(response.headers)

9 changes: 6 additions & 3 deletions examples/clients/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
# Retrieve email statistics by client type. #
# GET /clients/stats #

params = {'aggregated_by': 'day', 'start_date': '2016-01-01', 'end_date': '2016-04-01'}
params = {'aggregated_by': 'day',
'start_date': '2016-01-01',
'end_date': '2016-04-01'}
response = sg.client.clients.stats.get(query_params=params)
print(response.status_code)
print(response.body)
Expand All @@ -19,10 +21,11 @@
# Retrieve stats by a specific client type. #
# GET /clients/{client_type}/stats #

params = {'aggregated_by': 'day', 'start_date': '2016-01-01', 'end_date': '2016-04-01'}
params = {'aggregated_by': 'day',
'start_date': '2016-01-01',
'end_date': '2016-04-01'}
client_type = "test_url_param"
response = sg.client.clients._(client_type).stats.get(query_params=params)
print(response.status_code)
print(response.body)
print(response.headers)

Loading

0 comments on commit 52f86b7

Please sign in to comment.