Skip to content

Commit 2c10c0a

Browse files
author
Rich Leland
committed
Add example for using base resource
1 parent 2527735 commit 2c10c0a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

examples/base_resource.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
from sparkpost.base import Resource
4+
5+
6+
class Webhooks(Resource):
7+
key = "webhooks"
8+
9+
def list(self, **kwargs):
10+
results = self.request('GET', self.uri, **kwargs)
11+
return results
12+
13+
14+
api_key = os.environ.get('SPARKPOST_API_KEY', None)
15+
webhooks = Webhooks('https://api.sparkpost.com/api/v1', api_key)
16+
17+
# returns a list of webhooks for your account
18+
print(webhooks.list())

0 commit comments

Comments
 (0)