Skip to content

Instantly share code, notes, and snippets.

@yurivictor
Last active January 2, 2016 11:49
Show Gist options
  • Save yurivictor/8299626 to your computer and use it in GitHub Desktop.
Save yurivictor/8299626 to your computer and use it in GitHub Desktop.
It's cold, am I in the office yet?
import json
import requests
API = 'https://api.forecast.io/forecast/'
KEY = 'c67cec34041e316f293bec1e1f5081dd'
def get_current_conditions( latitude, longitude ):
url = API + KEY + '/' + latitude + ',' + longitude
request = requests.get( url )
data = request.content
weather = json.loads( data )
return weather['currently']['temperature']
def is_yuri_in():
temperature = get_current_conditions( '38.895', '-77.0373' )
print '====================================='
print 'IS YURI IN THE OFFICE YET?'
print 'Current temperature: ' + str( temperature )
if temperature > 10:
print 'Probably.'
else:
print 'Nope. Nope. Nope.'
is_yuri_in()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment