urllib2.HTTPError: HTTP Error 403: Forbidden
程序员文章站
2022-05-29 22:18:46
...
添加
request.add_header('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36')
url = ''
request = urllib2.Request(url)
request.add_header('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36')
response = urllib2.urlopen(request,timeout=30)
downloadFileData = response.read()
print downloadFileData
推荐阅读
-
(发送post请求报错)There was an unexpected error (type=Forbidden, status=403). Forbidden
-
urllib2.HTTPError: HTTP Error 403: Forbidden 分类: ...
-
urllib2.HTTPError: HTTP Error 403: Forbidden
-
urllib2.HTTPError: HTTP Error 403: Forbidden
-
解决错误: raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403:
-
网络爬虫urllib.error.HTTPError: HTTP Error 403: Forbidden的问题方法
-
urllib.error.HTTPError: HTTP Error 403: Forbidden 解决办法
-
使用python爬取图片写入文件夹,附urllib.error.HTTPError: HTTP Error 403: Forbidden问题解决
-
python3.3 urllib.error.HTTPError: HTTP Error 403: Forbidden
-
爬虫403问题解决urllib.error.HTTPError: HTTP Error 403: Forbidden