def checkIfInCA(): """ checks if the requested city is in Canada if it is then returns true else returns false """ data = api_req.req() try: if (data["sys"]["country"] == "CA"): return True else: return False except KeyError: return False
def wind(): "Takes a jsonObject and returns the wind speed and degree" data = api_req.req() return ('Wind speed of ' + str(data["wind"]["speed"]) + " at an angle of " + str(data["wind"]["deg"]) + " degrees.")
def temperature(): "takes a jsonObject and returns the temeprature" data = api_req.req() return (data["main"]["temp"])
def weatherIconId(): "takes a jsonObject and returns the weather icon id" data = api_req.req() return (data["weather"][0]["icon"])
def weatherDescription(): "takes a jsonObject and returns the weather description as a string" data = api_req.req() return (data["weather"][0]["description"])
def weatherMain(): "takes a jsonObject and returns the main weather as a string" data = api_req.req() return (data["weather"][0]["main"])