python拦截http请求_如何使用Python 3抑制在request.get()请求期间记录的http.client异常...

2018-04-2017:14:27|RF5MR:ConnectionError!Traceback(most recent call last):File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py",line601,inurlopenchunked=chunked)File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py",line387,in_make_requestsix.raise_from(e,None)File"",line2,inraise_fromFile"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py",line383,in_make_requesthttplib_response=conn.getresponse()File"/usr/lib/python3.6/http/client.py",line1331,ingetresponseresponse.begin()File"/usr/lib/python3.6/http/client.py",line297,inbeginversion,status,reason=self._read_status()File"/usr/lib/python3.6/http/client.py",line266,in_read_statusraiseRemoteDisconnected("Remote end closed connection without"http.client.RemoteDisconnected:Remoteend closed connection without responseDuringhandling of the above exception,another exception occurred:Traceback(most recent call last):File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/adapters.py",line440,insendtimeout=timeoutFile"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py",line639,inurlopen_stacktrace=sys.exc_info()[2])File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/urllib3/util/retry.py",line388,inincrementraiseMaxRetryError(_pool,url,errororResponseError(cause))urllib3.exceptions.MaxRetryError:HTTPSConnectionPool(host='www.thesite.com',port=443):Maxretries exceededwithurl:/asdzxcqwe/2058706(CausedbyProxyError('Cannot connect to proxy.',RemoteDisconnected('Remote end closed connection without response',)))Duringhandling of the above exception,another exception occurred:Traceback(most recent call last):File"/opt/scripts/this-is-my-app/fetcher.py",line417,inmake_requestresp=self.s.get(url,proxies=self.proxies)File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/sessions.py",line521,ingetreturnself.request('GET',url,**kwargs)File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/sessions.py",line508,inrequestresp=self.send(prep,**send_kwargs)File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/sessions.py",line640,insendhistory=[respforrespingen]ifallow_redirectselse[]File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/sessions.py",line640,inhistory=[respforrespingen]ifallow_redirectselse[]File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/sessions.py",line218,inresolve_redirects**adapter_kwargsFile"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/sessions.py",line618,insendr=adapter.send(request,**kwargs)File"/opt/scripts/this-is-my-app/.venv/lib/python3.6/site-packages/requests/adapters.py",line502,insendraiseProxyError(e,request=request)requests.exceptions.ProxyError:HTTPSConnectionPool(host='www.thesite.com',port=443):Maxretries exceededwithurl:/asdzxcqwe/2058706(CausedbyProxyError('Cannot connect to proxy.',RemoteDisconnected('Remote end closed connection without response',)))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值