web crawling(plus3) errors solution

301 moved permanently

302 found

303 not modified

400 bad request

401 unauthorized

403 forbidden

404 not found

500 internal server error

501 not implementedh

URLError >HTTPError

URLError: not linked the internal server: no web connection; remote url not exit; HTTPError

******************************************

import urllib.error
import urllib.request
try:
urllib.request.urlopen("http://blog.cssdn.net")
except urllib.error.URLError as e:
if hasattr(e,"code"):
print(e.code)
if hasattr(e,"reason"):
print(e.reason)

 

posted @ 2017-10-02 16:46  兔子的尾巴_Mini  阅读(132)  评论(0)    收藏  举报