forked from sendgrid/sendgrid-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclients.py
30 lines (24 loc) · 882 Bytes
/
clients.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sendgrid
import os
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve email statistics by client type. #
# GET /clients/stats #
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)
print(response.headers)
##################################################
# 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'}
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)