Last active
September 19, 2015 12:17
-
-
Save balkian/1462976b537a1d661e1d to your computer and use it in GitHub Desktop.
Get a notification when a kemsirve/kimsufi server is available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import requests | |
try: | |
import Tkinter as tk | |
import tkMessageBox as tkm | |
except Exception: | |
import tkinter as tk | |
from tkinter import messagebox as tkm | |
window = tk.Tk() | |
window.wm_withdraw() | |
resp = requests.get("https://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2") | |
for i in resp.json()["answer"]["availability"]: | |
if i["reference"] in ["150sk10", "150sk20"]: | |
for j in i["metaZones"]: | |
if j["availability"] not in ["unavaible", "unknown"]: | |
print(j["zone"], j["availability"]) | |
tkm.showinfo(title="Greetings", | |
message="%s: %s - %s!" % (i["reference"], | |
j["zone"], | |
j["availability"])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch -n 60 python kemsirve.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment