99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2018-10-24 閱讀量: 1388
python爬蟲中斷問題和處理1

報錯:requests.exceptions.ConnectionError

原因:

網(wǎng)絡(luò)問題出現(xiàn)的異常事件(如DNS錯誤,拒絕連接,等等),這是Requests庫中自帶的異常

解決方法:

1.捕捉基類異常,一次解決

try:

r = requests.get(url, params={’s’: thing})

except requests.exceptions.RequestException as e: # This is the correct syntax

print e

sys.exit(1)

2.分別處理各種異常,比如:

r = requests.get(url, params={’s’: thing})

except requests.exceptions.Timeout:

except requests.exceptions.TooManyRedirects:

except requests.exceptions.RequestException as e:

print e

sys.exit(1)

72.8088
1
關(guān)注作者
收藏
評論(0)

發(fā)表評論

暫無數(shù)據(jù)
推薦帖子