Skip to content

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

Description

@ecatkins

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions