MatthewFlamm / pynws

⛈️ A python library to asynchronously retrieve weather observation from NWS/NOAA
MIT License
31 stars 8 forks source link

Add more conditions for retries #194

Open MatthewFlamm opened 2 months ago

MatthewFlamm commented 2 months ago

It might be useful to have other conditions kick off retry attempts, e.g.

MatthewFlamm commented 2 months ago

A problem with the current use of call_with_retry that wraps any update_* call is that is is harder to make special cases for update_observation for example.

MatthewFlamm commented 2 months ago

One thought that I like is to have a new keyword arg for each update_* method that would raise an error when some condition is met for the data coming back from the update. We could use NWSError or subclass from it.

This would allow us to catch those specific errors in the retry, it also allows downstream codes to catch them.

MatthewFlamm commented 2 months ago

Observations already allow a start_time parameter, right now we trust NWS to satisfy this request. We should also filter it if user supplies this and NWS returns old data.