Skip to content

Commit

Permalink
Add example for using base resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Leland committed Feb 16, 2017
1 parent 2527735 commit 2c10c0a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/base_resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

from sparkpost.base import Resource


class Webhooks(Resource):
key = "webhooks"

def list(self, **kwargs):
results = self.request('GET', self.uri, **kwargs)
return results


api_key = os.environ.get('SPARKPOST_API_KEY', None)
webhooks = Webhooks('https://api.sparkpost.com/api/v1', api_key)

# returns a list of webhooks for your account
print(webhooks.list())

0 comments on commit 2c10c0a

Please sign in to comment.