ZeevG / python-forecast.io

A thin Python Wrapper for the Dark Sky (formerly forecast.io) weather API
http://zeevgilovitz.com/python-forecast.io/
Other
424 stars 88 forks source link

currently option is broken #51

Closed bonedaddy closed 7 years ago

bonedaddy commented 7 years ago

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

JayGray commented 7 years ago

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 7 years ago

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.