Created
May 3, 2012 14:37
-
-
Save spion/2586074 to your computer and use it in GitHub Desktop.
This file contains 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
import sys | |
import urllib2 | |
import json | |
lst = [] | |
while (True): | |
lst.append(float(S.readline())); | |
if (len(lst) == 60): | |
avg = sum(lst) / len(lst) | |
lst = [] | |
urllib2.urlopen(urllib2.Request("http://localhost:8080/push/update", | |
json.dumps({'type':'temperature', 'values': {'s1':avg}}), | |
{'content-type': 'application/json'})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment