建设网站的请示,品牌运营岗位职责,哪里网站备案快,2023年没必要学php了刚刚在使用Python写爬虫#xff0c;但是由于我在公司没有上网权限#xff0c;所以借别人的账号用(opera 浏览器代理 可有上网)#xff0c;我将代理信息写在python脚本里面但是出现了下面的错误.代码:import urllib2proxy_info {user : xxx ,pass : xxxx ,host : xx.xx.xx.x…刚刚在使用Python写爬虫但是由于我在公司没有上网权限所以借别人的账号用(opera 浏览器代理 可有上网)我将代理信息写在python脚本里面但是出现了下面的错误.代码:import urllib2proxy_info {user : xxx ,pass : xxxx ,host : xx.xx.xx.xx ,port : xx}# build a new opener that uses a proxy requiring authorizationproxy_support urllib2.ProxyHandler({http : \http://%(user)s:%(pass)s%(host)s:%(port)d % proxy_info})opener urllib2.build_opener(proxy_support, urllib2.HTTPHandler)# install iturllib2.install_opener(opener)# use itf urllib2.urlopen(http://www.baidu.com/)print f.headersprint f.read()错误:Traceback (most recent call last):File D:\software\eclipse\workspace\pythonproject\dev\spider\ProxyHandler.py, line 19, in f urllib2.urlopen(http://www.baidu.com/)File C:\Python27\lib\urllib2.py, line 126, in urlopenreturn _opener.open(url, data, timeout)File C:\Python27\lib\urllib2.py, line 398, in openresponse meth(req, response)File C:\Python27\lib\urllib2.py, line 511, in http_responsehttp, request, response, code, msg, hdrs)File C:\Python27\lib\urllib2.py, line 436, in errorreturn self._call_chain(*args)File C:\Python27\lib\urllib2.py, line 370, in _call_chainresult func(*args)File C:\Python27\lib\urllib2.py, line 519, in http_error_defaultraise HTTPError(req.get_full_url(), code, msg, hdrs, fp)urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required( Forefront TMG requires authorization to fulfill the request.Access to the Web Proxy filter is denied. )urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )请问这是什么原因造成的呀可有什么解决建议啊谢谢大家了