Comments (9)
This sort of error is checked for elsewhere, so it should be checked for here as well. I'll have a look at putting some in
from datapoint-python.
Here are a few more examples of site_id where it falls over
[354281, 354091, 322183, 352294, 310120, 350410]
from datapoint-python.
I can't reproduce the error currently:
>>> conn = datapoint.Manager(api_key=key)
>>> ids = [354281, 354091, 322183, 352294, 310120, 350410]
>>> for id in ids:
... forecast = conn.get_forecast_for_site(id, "3hourly")
... print(forecast.continent)
...
EUROPE
EUROPE
EUROPE
EUROPE
EUROPE
EUROPE
From the error in the screenshot it looks like some data wasn't returned from the API and the package failed to handle this.
from datapoint-python.
In the past I've had similar issues with 'Location' being the error rather than 'continent'.
I can raise another issue if it happens again.
from datapoint-python.
Just to let you know the issue happened again today between 2pm and 3pm.
The error this time was 'Location'
The following sites failed 354352,324164,324228,353879,353006,351392,350413,352458,351625,3784,352664,99203,350891,354251,3876,353217,350702,353358,350266,3796,353607,350153,352930,353007,350236,353289,351029,351668,351802,350193,353058,350047,353039,353965,351976,3693,351081,350768,350883,350812,350893,352823,354137,352730,350602,354243,324189,353233,354357,351854,353128,352438,354344,351634,352251,350885,352791,352785,353394,350163,351850,351742,352806,354362,351493,354169,353179,352061,352880,353525,350929,350842,353733,352068,356043
from datapoint-python.
This problem is due to the API rather than this library. The focus here just needs to be on good error handling.
from datapoint-python.
Another thing to check:
line 370, in get_forecast_for_site
for day in data['SiteRep']['DV']['Location']['Period']:
KeyError: 'Location'
Need to check if this is fixed in #103
from datapoint-python.
This has happened today at 945am and still ongoing.
running simple_forecast.py with
site = conn.get_nearest_forecast_site(52.5998000, -2.14030000)
gives
Wolverhampton Racecourse
Traceback (most recent call last):
File "simple_forecast.py", line 12, in <module>
forecast = conn.get_forecast_for_site(site.id, "3hourly")
File "/home/d14xj1/.venvs/datapoint/lib/python3.6/site-packages/datapoint/Manager.py", line 370, in get_forecast_for_site
for day in data['SiteRep']['DV']['Location']['Period']:
KeyError: 'Location'
and the following site id's are known to be effected
354281,353639,351907,351223,354352,351392,350413,3876,353217,353358,353007,350236,353289,351029,351414,351668,351802,353058,350047,3693,350883,350893,352823,350602,324189,3781,351854,353128,352251,350885,350163,354169,352061,352880,353525,356043
Note i'm using version 0.9.1
from datapoint-python.
The change in #103 did not fix the issue - that change leaves some fields empty if the location
key is missing and then falls over when the key is accessed again. We should fail if the location
key is missing as I think that means that there is no forecast data to return
from datapoint-python.
Related Issues (20)
- Make exceptions clearer HOT 1
- get_nearest_observation_site can return False HOT 1
- Refactor get_observations_for_site and get_forecast_for_site
- Remove import * from tests HOT 1
- Re-order logic in Forecast.at_datetime
- Remove Forcast.now_old() and Forecast.future_old() HOT 2
- Should installation of requirements be first in travis.yml? HOT 1
- Use something other than nose for tests HOT 1
- 'bool' object has no attribute 'date' HOT 2
- Add print capabilities to Day, Timestep etc.
- Make forecast know if it is 3 hourly or daily HOT 2
- Met Office Datahub to replace Datapoint HOT 1
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- Use something other than id in Element
- Remove api key from Timestep HOT 4
- Remove frequency option from get_observations_for_site, it can only be hourly HOT 1
- Problem setting API key
- Python 3.12, versioneer build failure HOT 6
- Migrate to modern package build
- Migrate away from Travis CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datapoint-python.