Last active
January 2, 2016 11:49
-
-
Save yurivictor/8299626 to your computer and use it in GitHub Desktop.
It's cold, am I in the office yet?
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 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