forked from sendgrid/sendgrid-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_v3_test.py
More file actions
executable file
·117 lines (92 loc) · 2.52 KB
/
example_v3_test.py
File metadata and controls
executable file
·117 lines (92 loc) · 2.52 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import sendgrid
import json
import os
if os.path.exists('.env'):
for line in open('.env'):
var = line.strip().split('=')
if len(var) == 2:
os.environ[var[0]] = var[1]
client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
"""
email = 'elmer.thomas+test_global0@gmail.com'
status, msg = client.asm_global_suppressions.delete(email)
print status
print msg
status, msg = client.suppressions.get()
print status
print msg
status, msg = client.asm_global_suppressions.post(['elmer.thomas+test_global0@gmail.com'])
print status
print msg
group_id = 70
status, msg = client.asm_suppressions.get(group_id)
print status
print msg
status, msg = client.asm_groups.post("Magic Key 2", "Unlock your Emails", False)
print status
print msg
status, msg = client.asm_groups.get()
print status
print msg
status, msg = client.asm_groups.post("Magic Key", "Unlock your Emails")
print status
print msg
status, msg = client.asm_groups.get()
print status
print msg
# In the global suppression list
status, msg = client.asm_global_suppressions.get('elmer.thomas+test_global@gmail.com')
print status
print msg
# Not in the global suppression list
status, msg = client.asm_global_suppressions.get('elmer.thomas@gmail.com')
print status
print msg
status, msg = client.apikeys.get()
print status
print msg
status, msg = client.asm_suppressions.delete(67,'elmer+test@thinkingserious.com')
print status
print msg
status, msg = client.asm_suppressions.post(60, ['elmer+test@thinkingserious.com', 'elmer.thomas@yahoo.com'])
print status
print msg
status, msg = client.asm_groups.get([66,67,50])
print status
print msg
name = "My Amazing API Key"
status, msg = client.apikeys.post(name)
msg = json.loads(msg)
api_key_id = msg['api_key_id']
print status
print msg
name = "My NEW API Key 3000"
status, msg = client.apikeys.patch(api_key_id, name)
print status
print msg
status, msg = client.apikeys.delete(api_key_id)
print status
status, msg = client.apikeys.get()
print status
print msg
# Get a list of all valid API Keys from your account
status, msg = client.apikeys.get()
print status
print msg
# Create a new API Key
name = "My API Key 10"
status, msg = client.apikeys.post(name)
print status
print msg
# Delete an API Key with a given api_key_id
api_key_id = "zc0r5sW5TTuBQGsMPMUx0A"
status, msg = client.apikeys.delete(api_key_id)
print status
print msg
# Update the name of an API Key, given an api_key_id
api_key_id = "API_KEY"
name = "My API Key 3"
status, msg = client.apikeys.patch(api_key_id, name)
print status
print msg
"""