Skip to content

Commit f54ba79

Browse files
committed
added functions for billing
1 parent 0264429 commit f54ba79

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

vscale.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,46 @@ def set_notifications(token, balance):
570570
headers={"X-Token": token},
571571
data={"notify_balance": str(balance)}
572572
)
573+
574+
575+
"""
576+
Function get_balance performs a GET-request at
577+
https://api.vscale.io/v1/billing/balance, returns information on balance.
578+
Token has to be provided as a str object.
579+
"""
580+
581+
582+
def get_balance(token):
583+
return requests.get("https://api.vscale.io/v1/billing/balance",
584+
headers={"X-Token": token}
585+
)
586+
587+
588+
"""
589+
Function get_payments performs a GET-request at
590+
https://api.vscale.io/v1/billing/payments, returns information on last
591+
payments.
592+
Token has to be provided as a str object.
593+
"""
594+
595+
596+
def get_payments(token):
597+
return requests.get("https://api.vscale.io/v1/billing/payments",
598+
headers={"X-Token": token}
599+
)
600+
601+
602+
"""
603+
Function consumption performs a GET-request at
604+
https://api.vscale.io/v1/billing/consumption. return all the spendings
605+
from start date till end date excluding the latter one.
606+
Token has to be provided as a str object.
607+
Start and end date have to be provided as a str object in form YYYY-MM-DD.
608+
"""
609+
610+
611+
def consumption(token, start, end):
612+
return requests.get("https://api.vscale.io/v1/billing/consumption"+
613+
"?start="+str(start)+"&end="+str(end),
614+
headers={"X-Token": token}
615+
)

0 commit comments

Comments
 (0)