From b8b793e292e9bbf774a29b4c9d96e9363acf14d4 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 1 Feb 2019 20:17:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E9=94=99=E8=AF=AF=E4=BA=BA?= =?UTF-8?q?=E6=80=A7=E5=8C=96=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinMain.py | 5 +++++ api.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/WinMain.py b/WinMain.py index 33eb671..72003a2 100644 --- a/WinMain.py +++ b/WinMain.py @@ -2,6 +2,8 @@ import os import sys import time +import requests + from Gift import Gift from Lottery import Lottery from MemberMsg import MemberMsg @@ -192,6 +194,9 @@ if __name__ == "__main__": os.system("title {}".format(api.getTitle())) try: api.getDanmaku() + except requests.exceptions.BaseHTTPError: + print("网络错误,请确认网络") + time.sleep(5) except Exception as e: print(e.__str__()) time.sleep(1) diff --git a/api.py b/api.py index 841d957..6a260f4 100644 --- a/api.py +++ b/api.py @@ -221,6 +221,9 @@ if __name__ == "__main__": if api.isLive: try: api.getDanmaku() + except requests.exceptions.BaseHTTPError: + print("网络错误,请确认网络") + time.sleep(5) except Exception as e: print(e) time.sleep(1)