Example #1
0
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
Example #2
0
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.")
Example #3
0
def temperature():
    "takes a jsonObject and returns the temeprature"
    data = api_req.req()

    return (data["main"]["temp"])
Example #4
0
def weatherIconId():
    "takes a jsonObject and returns the weather icon id"
    data = api_req.req()

    return (data["weather"][0]["icon"])
Example #5
0
def weatherDescription():
    "takes a jsonObject and returns the weather description as a string"
    data = api_req.req()

    return (data["weather"][0]["description"])
Example #6
0
def weatherMain():
    "takes a jsonObject and returns the main weather as a string"
    data = api_req.req()

    return (data["weather"][0]["main"])