smard-api icon indicating copy to clipboard operation
smard-api copied to clipboard

ApiTypeError when some None values are returned.

Open Armagetron opened this issue 3 years ago • 1 comments

When querying some timestamps, it might happen, that the service returns some None values. The python client cannot handle them and returns the error

deutschland.smard.exceptions.ApiTypeError: Invalid type for variable '1'. Required value type is float and passed type was NoneType at ['received_data']['series'][87][1]

Can the model be updated to allow None values? I would rather have some None values in the response than an exception in this particular case.

Armagetron avatar Nov 03 '22 15:11 Armagetron

I figured out that you can do

configuration = smard.Configuration(
    discard_unknown_keys=True
)

However I still think this should be default.

Armagetron avatar Nov 04 '22 10:11 Armagetron