weatherbit / weatherbit-python

A python weather api wrapper for weatherbit.io
MIT License
28 stars 9 forks source link

'Api' object has no attribute 'set_granularity' #2

Closed jeongyoonlee closed 2 years ago

jeongyoonlee commented 6 years ago

The example code returns error:

from weatherbit.api import Api
api_key = "6b314d823dfa4651825ff99026e19e6e"
api = Api(api_key)
api.set_granularity('daily')
> AttributeError: 'Api' object has no attribute 'set_granularity'
mushroomRetainer commented 6 years ago

I think the example code is incorrect. I found you can get it working with one of these two approaches:

  1. the method is actually "set_forecast_granularity":

    api = Api(api_key)
    api.set_forecast_granularity('daily')
  2. or you can define the granularity when you create the Api object

    api = Api(api_key, granularity='daily')

They really should update their example code so that it actually works.