diff --git a/apps/third/dahua.py b/apps/third/dahua.py index f8f69400..6f4a0ab1 100644 --- a/apps/third/dahua.py +++ b/apps/third/dahua.py @@ -135,9 +135,11 @@ class DhClient: json_data['deviceCode'] = d_code json_data['params'] = '{\"method\":\"dev.snap\",\"id\":123,\"params\":{\"DevID\":\"' + \ str(d_code) + '\",\"DevChannel\":' + str(num) + ',\"PicNum\":1,\"SnapType\":1,\"CmdSrc\":0}}' - _, res = self.request(**dhapis['dev_snap'], json=json_data) - res = json.loads(res) - return self.get_full_pic(res['params']['PicInfo']) + is_ok, res = self.request(**dhapis['dev_snap'], json=json_data) + if is_ok == 'success': + res = json.loads(res) + return self.get_full_pic(res['params']['PicInfo']) + return None def get_password_token(self): _, res = self.request(**dhapis['oauth_key'])