Skip to content

Commit 5f71834

Browse files
jvanderneutstulenfabaff
authored andcommitted
When receiving an empty api response, only reset the measurements. (#2)
Currently all measurement keys are removed when receiving an empty response. The object will not recover from this and will log an exception when accessing `self.values.keys()` on a subsequent, succesful, response.
1 parent 87c2318 commit 5f71834

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

luftdaten/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ async def get_data(self):
4343
raise exceptions.LuftdatenConnectionError()
4444

4545
if not self.data:
46-
self.values = self.meta = None
46+
for measurement in self.values.keys():
47+
self.values[measurement] = None
4748
return
4849

4950
try:

0 commit comments

Comments
 (0)