Skip to content

Impliment a better way to handle API options #26

Description

@ZeevG

Currently some of the API options (https://developer.forecast.io/docs/v2#options) can be accessed by optional function parameters to load_forecast().

The forecast units is an example of an API option which is supported. However there is a need to properly support additional options see #25 #19. Currently these use cases are being supported by manually constructing a url and using forecastio.manual()

I am hesitant to clutter up load_forecast() with many optional parameters especially since it is likely more are made available by forecast.io in the future.

A possible solution is to pass any optional parameters to load_forecast() as a dictionary where it would work something like this...

options = {
    'units': 'si',
    'lang': 'es',
    'solar': True
}

forecastio.load_forecast(api_key, lat, lng, options)

The dictionary key/value would be transformed to the GET parameter name/value - the forecast.io API options are really just GET parameters.

This change would break backwards compatibility and so should be implemented along with the other changes planned for version 2.0 - see Milestone v2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions