Simple Observations Request Example

Code:


    from aerisweather.aerisweather import AerisWeather
    from aerisweather.requests.RequestLocation import RequestLocation
    from keys import client_id, client_secret, app_id


    # instantiate our aerisweather object
    aeris = AerisWeather(client_id=client_id, client_secret=client_secret, app_id=app_id)

    # create a RequestLocation object to be used with any endpoint requests
    loc = RequestLocation(city="minneapolis", state="mn")    

    # create a simple observations request with no options
    obs_list = aeris.observations(location=loc)

    for obs in obs_list:
        # get the AerisPlace responses object
        place = obs.place

        # get the observations data object
        ob = obs.ob

        # get some observations data
        tempF = ob.tempF
        weather = ob.weather

        print("Simple Observations Request Example:")
        print("The current weather for " + place.name + ", " + place.state + ":")
        print("Conditions are currently " + weather + " with a temp of " + str(tempF) + "°F")

Expected output:

Simple Observations Request Example:
The current weather for minneapolis, mn:
Conditions are currently Mostly Cloudy with a temp of 65°F

*The actual values may vary