ZeevG/python-forecast.io

currently option is broken

Closed this issue · 2 comments

Following errors occurs when trying to use currently method

currently = forecast.currently()
currently.data
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/python_forecastio-1.3.5-py3.4.egg/forecastio/models.py", line 103, in getattr
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/python_forecastio-1.3.5-py3.4.egg/forecastio/models.py", line 107, in getattr
forecastio.utils.PropertyUnavailable: Property 'data' is not valid or is not available for this forecast

From my understanding currently is a Data Point Object and doesn't have the property data
just try to get what you want.
eg.

forecast = forecastio.load_forecast(api_key, lat, lng)
current = forecast.currently()

print current.windSpeed
print current.windBearing
ZeevG commented

Thanks. Indeed, unlike the other time frame functions currently returns a data point not a data block.

This is because daily for example would return multiple forecasts for each day going forward. Currently only returns a single forecast for right now.