Skip to content

Commit 77eaff9

Browse files
authored
Merge pull request ReolinkCameraAPI#59 from deadc0de6/fix-no-value
fix KeyError: value
2 parents 23209f4 + d59ceff commit 77eaff9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

reolinkapi/mixins/motion.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ def get_motion_files(self, start: dt, end: dt = dt.now(),
4646
body = [{"cmd": "Search", "action": 1, "param": search_params}]
4747

4848
resp = self._execute_command('Search', body)[0]
49-
result = resp['value']['SearchResult']
49+
if 'value' not in resp:
50+
return []
51+
values = resp['value']
52+
if 'SearchResult' not in values:
53+
return []
54+
result = values['SearchResult']
5055
files = result.get('File', [])
5156
if len(files) > 0:
5257
# Begin processing files

0 commit comments

Comments
 (0)