From 426f4d627347f4a6a9a2e51f7a1573d1dfb48641 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Thu, 14 Mar 2019 17:59:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=94=B9=E8=BF=9B=EF=BC=9A?= =?UTF-8?q?=E5=BD=95=E6=92=AD=E5=B7=A5=E5=85=B7=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liveDownloader.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/liveDownloader.py b/liveDownloader.py index b2e54ea..b465d26 100644 --- a/liveDownloader.py +++ b/liveDownloader.py @@ -74,21 +74,22 @@ def download(url): p = requests.get(url, stream=True) if p.status_code != 200: isUpload = True + print("{} : Download Response 404 ,will stop looping".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"))) return True + print("{} : Download {}".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"), path)) f = open(path, "ab") try: - print("{} : Download {}".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"), path)) for t in p.iter_content(chunk_size=64*1024): if t: f.write(t) if os.path.getsize(path) > 1024*1024*1024*1.5: break - except: - pass + print("{} : Download Quiting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"))) + except Exception as e: + print("{} : Download Quiting With Exception {}".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"),e.__str__())) f.close() isUpload = True uq.put(path) - print("{} : Download Daemon Quiting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M"))) download(url)