MBalazs90/WeatherV1.0

Wrong indentation

Stophface opened this issue · 0 comments

Thanks for the script!
I think you got a indentation error:

def get_temp(lat, lon):
    data = urlopen("http://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&appid=YOURIDHERE&cnt=1" % (lat, lon))
    js_data = json.loads(data.read().decode('utf-8'))
    try:
        return js_data['main']['temp'] - 273.15
    except (KeyError, IndexError):
        return None

    return get_temp(lat, lon)

The return get_temp(lat, lon) should not be on the level of def get_temp(lat, lon). It rather should be:

def get_temp(lat, lon):
    data = urlopen("http://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&appid=YOURIDHERE&cnt=1" % (lat, lon))
    js_data = json.loads(data.read().decode('utf-8'))
    try:
        return js_data['main']['temp'] - 273.15
    except (KeyError, IndexError):
        return None

return get_temp(lat, lon)