Skip to content

Instantly share code, notes, and snippets.

@ibanezmatt13
Created August 21, 2013 19:50
Show Gist options
  • Save ibanezmatt13/6299277 to your computer and use it in GitHub Desktop.
Save ibanezmatt13/6299277 to your computer and use it in GitHub Desktop.
import requests
import json
from twython import Twython
altitude_reached = False
APP_KEY = 'Atdroh949549595959595959595OudNPFZ7ThCegNA'
APP_SECRET = '9rr9WugisXQL8cK4bViuf8gRffsffffff9roYVvIUYt5l4GaEHg'
OAUTH_KEY = '1581565303-3t0YcrYqLe8dffaUIwWbyAxb2KmGdsIH8u2NOdk7W3'
OAUTH_SECRET = 'ooGqejbNtmkxTywBfdfffgf0TtqzVOP32YXuiG875m2BY5BWU'
altitude_json_link = "http://habitat.habhub.org/habitat/_design/ept/_list/json/payload_telemetry/payload_time?include_docs=true&startkey=[%22c3d528cd4dcc690f7c7d5e7a014ba642%22]&endkey=[%22c3d528cd4dcc690f7c7d5e7a014ba642%22,[]]&fields=altitude"
while True:
r = requests.get(altitude_json_link)
altitude = float(r.json()[-1]["altitude"])
print altitude
if altitude >= 30000 and altitude_reached == False:
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_KEY, OAUTH_SECRET)
twitter.update_status(status='Reached Altitude: 30,000m! :D')
altitude_reached = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment