Last active
December 21, 2015 11:29
-
-
Save ibanezmatt13/6299543 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 requests | |
import json | |
triggered = False | |
altitude_json_link = "http://habitat.habhub.org/habitat/_design/ept/_list/json/payload_telemetry/payload_time?include_docs=true&startkey=[%22ba0e1230c8dbab3d32b4735aa581b873%22]&endkey=[%22ba0e1230c8dbab3d32b4735aa581b873%22,[]]&fields=altitude" # altitude link from Habitat | |
trigger_json_link = "http://habitat.habhub.org/habitat/_design/ept/_list/json/payload_telemetry/payload_time?include_docs=true&startkey=[%22ba0e1230c8dbab3d32b4735aa581b873%22]&endkey=[%22ba0e1230c8dbab3d32b4735aa581b873%22,[]]&fields=trigger" # trigger link from Habitat | |
while True: # forever | |
r = requests.get(altitude_json_link) # get the JSON information | |
altitude = float(r.json()[-1]["altitude"]) # parse altitude to get a float | |
print "The altitude is: " + altitude # print altitude | |
r = requests.get(trigger_json_link) # get the JSON information | |
trigger = float(r.json()[-1]["trigger"]) # parse trigger | |
print "The trigger is: " + trigger # print trigger | |
if altitude >= 29500 and triggered == False: # if altitude = 30000m and altitude hasn't already been reached | |
#url | |
print "Bet Placed! Exiting..." | |
triggered = True | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment