Optimizing API Requests

The Aeris API offers several request properties designed to improve response time and reduce the amount of data returned. Each weather API endpoint has a unique set of request properties for its specific data. To see the various request properties for a specific endpoint, check out the corresponding endpoint docs.

In the Aeris Python library, we have mapped each of these properties to their own class, and reduced the available options to only those that apply to each endpoint.

The endpoint request properties are broken down into the following categories:

  • RequestAction
  • RequestFilter
  • RequestParameter
  • RequestField
  • RequestQuery
  • RequestSort

When using the Aeris Python SDK, you can add these properties to your requests through the optional parameters passed to the request methods. For example:


    obs_list = aeris.observations(action=RequestAction.OBSERVATIONS.CLOSEST,
                              filter_=[RequestFilter.OBSERVATIONS.ALL_STATIONS],
                              params={ParameterType.OBSERVATIONS.P: "minneapolis,mn",
                                      ParameterType.OBSERVATIONS.FIELDS: "place, ob.tempF,ob.weather"})

The above Observations request is using an Action property of "Closest", a Filter property of "All Stations" and two Parameter options "p" and "Fields". This will provide a very specific set of Observations data for the location.

You can check out more code examples here to see different ways of using these properties in your requests.