Skip to content

Commit 0264429

Browse files
committed
added functions for notifications
1 parent 9426261 commit 0264429

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

vscale.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,4 +540,33 @@ def delete_ssh(token, keyid):
540540
headers={"Content-Type":
541541
"application/json;charset=UTF-8",
542542
"X-Token": token}
543-
)
543+
)
544+
545+
546+
"""
547+
Function notifications performs a GET-request at
548+
https://api.vscale.io/v1/billing/notify, return information on notification
549+
policy.
550+
Token has to be provided as a str object.
551+
"""
552+
553+
554+
def notifications(token):
555+
return requests.get("https://api.vscale.io/v1/billing/notify",
556+
headers={"X-Token": token}
557+
)
558+
559+
560+
"""
561+
Function set_notifications performs a PUT-request at
562+
https://api.vscale.io/v1/billing/notify, sets new notification policy.
563+
Token has to be provided as a str object.
564+
Balance has to be provided as a str object.
565+
"""
566+
567+
568+
def set_notifications(token, balance):
569+
return requests.put("https://api.vscale.io/v1/billing/notify",
570+
headers={"X-Token": token},
571+
data={"notify_balance": str(balance)}
572+
)

0 commit comments

Comments
 (0)