Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling for invalid date (and potentially other errors) #16

Open
ecatkins opened this issue Jan 10, 2021 · 0 comments
Open

Error handling for invalid date (and potentially other errors) #16

ecatkins opened this issue Jan 10, 2021 · 0 comments

Comments

@ecatkins
Copy link

It appears if you reach the historical limit for weather data (e.g. I was trying to scrape for a date in 2008), the API returns an error message:

{'error': [{'msg': 'There is no weather data available for the date provided.'}]}

However the library currently does not handle for this, and just errors with:

  File "/my/path/lib/python3.8/site-packages/wwo_hist/__init__.py", line 103, in retrieve_this_location
    data = json_data['data']['weather']
KeyError: 'weather'

Would it be desirable to at least provide this error message back to the user? I'm happy to make a pull request if you agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant