推 kenduest: 用 requests , requests.get() 可傳 timeout 方式看看 12/29 12:53
推 kenduest: urllib open 似乎也有 timeout, 不過整個不符合你需求 12/29 13:10
→ kenduest: 抱歉回應沒有回答到答案 12/29 13:23
推 ocean5566: try .... except .... 12/29 21:25
→ ocean5566: * 加上 while 若抓完了就break出去 12/29 21:26
→ kenduest: 這個問題剛想到似乎得用 gevent 方式來解決才會簡單 12/29 22:39
→ kenduest: 不過檔案很小感覺一般不需要這種方案才對 12/29 22:41
→ kenduest: 若檔案很大,一般大多使用 requests 會搭配 stream=True 12/29 22:41
→ kenduest: 然後iter_content() 方式指定chunk size 讀進來處理 12/29 22:42