Skip to content

Instantly share code, notes, and snippets.

@MatejMecka
Created October 24, 2017 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatejMecka/706927036f7a8b577e3c9f7838820df4 to your computer and use it in GitHub Desktop.
Save MatejMecka/706927036f7a8b577e3c9f7838820df4 to your computer and use it in GitHub Desktop.
Status na Hacklabot/
# _*_ 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