KeyError Handler
This commit is contained in:
parent
1c9ca05d34
commit
14d7fcd9e3
11
main.py
11
main.py
|
@ -148,10 +148,13 @@ if __name__ == '__main__':
|
||||||
for popout in json.loads(res.text)['data']['list']:
|
for popout in json.loads(res.text)['data']['list']:
|
||||||
popid = popout['id']
|
popid = popout['id']
|
||||||
clear_result = r.post('https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification', headers=headers, data={'id': popid})
|
clear_result = r.post('https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification', headers=headers, data={'id': popid})
|
||||||
if clear_result.status_code == 200 and clear_result.json()['msg'] == 'OK':
|
try:
|
||||||
print(f'已清除id为{popid}的弹窗!')
|
if clear_result.status_code == 200 and clear_result.json()['msg'] == 'OK':
|
||||||
else:
|
print(f'已清除id为{popid}的弹窗!')
|
||||||
print(f'清除弹窗失败!错误信息为:{clear_result.text}')
|
else:
|
||||||
|
print(f'清除弹窗失败!返回信息为:{clear_result.text}')
|
||||||
|
except KeyError as e:
|
||||||
|
print(f'清除弹窗失败!返回信息为:{clear_result.text};错误信息为:{e}')
|
||||||
else:
|
else:
|
||||||
raise RunError(
|
raise RunError(
|
||||||
f"签到失败!请带着本次运行的所有log内容到 https://github.com/ElainaMoe/MHYY-AutoCheckin/issues 发起issue解决(或者自行解决)。签到出错,返回信息如下:{res.text}")
|
f"签到失败!请带着本次运行的所有log内容到 https://github.com/ElainaMoe/MHYY-AutoCheckin/issues 发起issue解决(或者自行解决)。签到出错,返回信息如下:{res.text}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user