2023-03-14 08:55:54 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2023-03-14 12:37:38 +00:00
|
|
|
import sys
|
2023-03-14 08:55:54 +00:00
|
|
|
import time
|
|
|
|
import traceback
|
|
|
|
|
|
|
|
from hosted import api, node
|
|
|
|
|
|
|
|
|
|
|
|
def fetch_info():
|
|
|
|
info = api.device_info.get()
|
|
|
|
print >> sys.stderr, info
|
|
|
|
node["/device_info"](
|
|
|
|
dict(
|
|
|
|
description=info["description"],
|
|
|
|
location=info["location"],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
while 1:
|
|
|
|
try:
|
|
|
|
fetch_info()
|
|
|
|
except:
|
|
|
|
traceback.print_exc()
|
|
|
|
finally:
|
|
|
|
time.sleep(15)
|