Skip to content

Instantly share code, notes, and snippets.

@spion
Created May 3, 2012 14:37
Show Gist options
  • Save spion/2586074 to your computer and use it in GitHub Desktop.
Save spion/2586074 to your computer and use it in GitHub Desktop.
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