Custom Endpoints Example


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

    # we need a couple of additional imports
    from aerisweather.responses.CustomResponse import CustomResponse
    from aerisweather.requests.Endpoint import Endpoint, EndpointType

    # let's get data from a valid endpoint, but one that's not in our Endpoint Enum. A use case for this might be
    # where we want to test a beta or pre-release endpoint
    aeriswx = AerisWeather(app_id=app_id,

    # define the custom endpoint type
    EndpointType.custom = "stormreports"

    # create an endpoint object, specifying CUSTOM as it's type, and let's go ahead and give the endpoint our location too
    endpoint = Endpoint(EndpointType.CUSTOM, location=RequestLocation(postal_code="54660"))

    # this will be a list of CustomResponse objects
    response_list = aeriswx.request(endpoint)
    response = response_list[0]

    # the response should have storm report data, so let's try to pull the report type
    print("The storm report type is: " +

Expected output:

The storm report type is: hail


*The actual values may vary

Last modified: July 30, 2020