bundesAPI / smard-api

https://smard.api.bund.dev
54 stars 8 forks source link

ApiTypeError when some None values are returned. #16

Open Armagetron opened 1 year ago

Armagetron commented 1 year ago

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 commented 1 year ago

I figured out that you can do

configuration = smard.Configuration(
    discard_unknown_keys=True
)

However I still think this should be default.