Skip to content

Instantly share code, notes, and snippets.

@shehaaz
Last active August 29, 2015 14:00
Show Gist options
  • Save shehaaz/0151963f1549089c98fe to your computer and use it in GitHub Desktop.
Save shehaaz/0151963f1549089c98fe to your computer and use it in GitHub Desktop.
#This fetches the summary for a user for a specific date: YYYYMMDD
r = requests.get(
'https://api.moves-app.com/api/1.1/user/activities/daily/'+ date +'?access_token=USERs_ACCESS_TOKEN')
js = json.load(r)
summary = js[0]['summary']
if summary is not None:
for x in range(len(summary)):
activity = summary[x]['activity']
if str(activity) == 'walking':
steps = summary[x]['steps']
curlArg = "curl -d {\"auth_token\":\"YOUR_AUTH_TOKEN\",\"current\":" + str(steps) + "} http://localhost:3030/widgets/WIDGET_ID
proc = subprocess.Popen(curlArg.split(), stdout=subprocess.PIPE)
output = proc.communicate()[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment