Skip to content

Commit

Permalink
added "credits" api call
Browse files Browse the repository at this point in the history
  • Loading branch information
Dru Ibarra authored and Dru Ibarra committed May 18, 2011
1 parent e4e6e37 commit 01b99b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pingdom-cli
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,25 @@ def usage():
print " modify - modify a check"
print " listnames - list all check names"
print " listids - list all check ids"
print " credits - return info on remaining checks and credits"
print ""


def pingdom_api_call(command, method, params=None):
if params != None:
try:
params = json.loads(str(params))
except ValueError, err:
print str(err) + ": %s" % params
sys.exit()

try:
res = pingdom_connection.method(command, method, params)
print json.dumps(res, sort_keys=True, indent=4)
except Exception, err:
print err
sys.exit()

def list_check_names():
try:
checks = pingdom_connection.method("checks", "GET")
Expand Down Expand Up @@ -202,6 +218,8 @@ if (len(sys.argv) >= 2):
list_check_names()
elif command == 'listids':
list_check_ids()
elif command == 'credits':
pingdom_api_call('credits', 'GET')
else:
usage()
else:
Expand Down

0 comments on commit 01b99b0

Please sign in to comment.