fix: Make get_multiple_*
methods pass tests by not halting for one bad input
#128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As laid out by the tests,
get_multiple_*_air
methods shouldn't halt when there is one bad input. One bad input (which in turn will make backend return error/bad response, which will make an exception raised in our part) shouldn't halt the execution of other, likely good, inputs. This is not convenient. For what it's worth, I've always treatedget_multiple_*
methods as convenience wrappers for their singleget_*_air
counterparts (otherwise I could just loop them myself).The example in my mind is this: you are mass-collecting data for a hundred cities. One city turns out to not have AQI station and subsequently raise exception (you likely won't know this in advance). It will be annoying to have the other 99 cities halted.
I realize that this will make an odd difference between e.g.
get_city_air
(raises exception on bad response) andget_multiple_cities_air
(returns nan row on bad response). I don't have really much to say either supporting or against.Is this a good or common enough use case? Should I implement things differently? I'm curious to hear more.