- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
#!/usr/bin/python
# encoding utf8
# head1 NAME
#
# stripe_account_balance
#
# CONFIGURATION
#
# This script is used to generate data for the number of customers that are
# attached to stripe
#
# APPLICABLE SYSTEMS
#
# Any
#
#
# CONFIGURATION
#
# you will need to have the following configuration items
# env.STRIPE_API_KEY_PROD
#
import sys, os, string, urllib2, stripe
from urllib2 import HTTPError
import socket
stripe.api_key = os.environ.get("STRIPE_API_KEY_PROD")
def get_stats():
try:
jsonPayload = stripe.Balance.retrieve()
print("BALANCE_PENDING.value %i" % (jsonPayload["pending"][0]["amount"]))
print("BALANCE_AVAILABLE.value %i" % (jsonPayload["available"][0]["amount"]))
except HTTPError, e:
sys.exit()
if __name__ == "__main__":
# are we doing config/autoconfig?
if(len(sys.argv) > 1):
if (sys.argv[1]=="config"):
print "graph_title Account Balance"
print "graph_vlabel Amount"
print "graph_category stripe"
# in green
print "BALANCE_PENDING.label Pending"
print "BALANCE_PENDING.colour 00cc00"
print "BALANCE_PENDING.draw LINE3"
print "BALANCE_AVAILABLE.label Available"
print "BALANCE_AVAILABLE.colour cc0000"
print "BALANCE_AVAILABLE.draw LINE3"
print "graph_args --base 1000 "
sys.exit()
get_stats()
Комментарии (2) RSS
Добавить комментарий