File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1313 ConnectionSetupError ,
1414 DataMissingError ,
1515 DeviceConnectionError ,
16+ KeyDataMissingError ,
1617)
1718
1819logger = logging .getLogger (__name__ )
@@ -203,7 +204,16 @@ async def status(self) -> dict:
203204 if response .status == 200 :
204205 try :
205206 response_text = await response .text ()
206- return json .loads (response_text )
207+ response_json = json .loads (response_text )
208+ if (
209+ "host" not in response_json
210+ or "device_id" not in response_json ["host" ]
211+ ):
212+ logger .error (
213+ "Source data missing 'host' or 'device_id' keys"
214+ )
215+ raise KeyDataMissingError from None
216+ return response_json
207217 except json .JSONDecodeError :
208218 logger .exception (
209219 "JSON Decode Error in authenticated status response"
Original file line number Diff line number Diff line change @@ -17,5 +17,9 @@ class DataMissingError(AirOSException):
1717 """Raised when expected data is missing."""
1818
1919
20+ class KeyDataMissingError (AirOSException ):
21+ """Raised when return data is missing critical keys."""
22+
23+
2024class DeviceConnectionError (AirOSException ):
2125 """Raised when unable to connect."""
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " airos"
7- version = " 0.1.0 "
7+ version = " 0.1.1 "
88license = " MIT"
99description = " Ubiquity airOS module(s) for Python 3."
1010readme = " README.md"
You can’t perform that action at this time.
0 commit comments