diff --git a/monitors/large_transfer.py b/monitors/large_transfer.py index f8e8b04..b561b7f 100644 --- a/monitors/large_transfer.py +++ b/monitors/large_transfer.py @@ -17,6 +17,11 @@ def run(): headers = {'Accept': 'application/json'} resp = requests.get(url, headers=headers).text + # 判断是否为JSON格式 + if json.dumps(resp) == False: + print(resp) + return + data = json.loads(resp) print(data) @@ -42,6 +47,4 @@ def run(): print(data) tg.send_message(settings.chat_id, data['message']) except: - print(resp) - logging.error(traceback.format_exc()) - tg.send_message(settings.chat_id, traceback.format_exc()) \ No newline at end of file + logging.error(traceback.format_exc()) \ No newline at end of file