Created
October 24, 2017 17:16
-
-
Save MatejMecka/706927036f7a8b577e3c9f7838820df4 to your computer and use it in GitHub Desktop.
Status na Hacklabot/
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
# _*_ coding: utf-8 _*_ | |
import requests | |
import json | |
import time | |
res = requests.get('https://db.softver.org.mk/influxdb/query?db=status&q=SELECT+doorstatus+FROM+doorstatus+WHERE+location=%27hacklab%27+ORDER+BY+time+DESC+LIMIT+1&epoch=ms') | |
data = json.loads(res.text) | |
if data['results'][0]['series'][0]['values'][0][1] == 'OPEN': | |
print "Хаклабот е отворен! и тоа од: " + str(time.strftime("%H:%M", time.localtime(int(data['results'][0]['series'][0]['values'][0][0])))) | |
else: | |
print "Хаклабот е затворен! и тоа од: " + str(time.strftime("%H:%M", time.localtime(int(data['results'][0]['series'][0]['values'][0][0])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment