欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

PythonRequests:proxy代理錯誤-創(chuàng)新互聯(lián)

目標:www.baidu.com

站在用戶的角度思考問題,與客戶深入溝通,找到衡陽縣網(wǎng)站設計與衡陽縣網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:網(wǎng)站制作、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、域名與空間、網(wǎng)站空間、企業(yè)郵箱。業(yè)務覆蓋衡陽縣地區(qū)。

源碼:

import?requests url?=?'http://www.baidu.com' header?=?{ 'User-Agent':?'Mozilla/5.0?(Windows?NT?6.1;?Win64;?x64)?AppleWebKit/537.36?(KHTML,?like?Gecko)?Chrome/76.0.3809.100?Safari/537.36' ????} free_proxy?=?{ #都是http類型地址 ##'http':?'163.204.241.160:9999' 'http':?'123.206.54.52:8118' ????} response?=?requests.get(url=url,?headers=header,?proxies=free_proxy) print(response.status_code)

使用代理'163.204.241.160:9999'出現(xiàn)

ProxyError

Traceback?(most?recent?call?last): ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\connection.py",?line?160,?in?_new_conn ????(self._dns_host,?self.port),?self.timeout,?**extra_kw) ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\util\connection.py",?line?80,?in?create_connection ????raise?err ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\util\connection.py",?line?70,?in?create_connection ????sock.connect(sa) ConnectionRefusedError:?[WinError?10061]?由于目標計算機積極拒絕,無法連接。 During?handling?of?the?above?exception,?another?exception?occurred: Traceback?(most?recent?call?last): ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\connectionpool.py",?line?603,?in?urlopen ????chunked=chunked) ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\connectionpool.py",?line?355,?in?_make_request ????conn.request(method,?url,?**httplib_request_kw) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?1244,?in?request ????self._send_request(method,?url,?body,?headers,?encode_chunked) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?1290,?in?_send_request ????self.endheaders(body,?encode_chunked=encode_chunked) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?1239,?in?endheaders ????self._send_output(message_body,?encode_chunked=encode_chunked) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?1026,?in?_send_output ????self.send(msg) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?966,?in?send ????self.connect() ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\connection.py",?line?183,?in?connect ????conn?=?self._new_conn() ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\connection.py",?line?169,?in?_new_conn ????self,?"Failed?to?establish?a?new?connection:?%s"?%?e) urllib3.exceptions.NewConnectionError:?<urllib3.connection.HTTPConnection?object?at?0x0000000003A6F048>:?Failed?to?establish?a?new?connection:?[WinError?10061]?由于目標計算機積極拒絕,無法連接。 During?handling?of?the?above?exception,?another?exception?occurred: Traceback?(most?recent?call?last): ??File?"D:\Software\python3.7.4\lib\site-packages\requests\adapters.py",?line?449,?in?send ????timeout=timeout ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\connectionpool.py",?line?641,?in?urlopen ????_stacktrace=sys.exc_info()[2]) ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\util\retry.py",?line?399,?in?increment ????raise?MaxRetryError(_pool,?url,?error?or?ResponseError(cause)) urllib3.exceptions.MaxRetryError:?HTTPConnectionPool(host='182.34.33.38',?port=9999):?Max?retries?exceeded?with?url:?http://www.baidu.com/?(Caused?by?ProxyError('Cannot?connect?to?proxy.',?NewConnectionError('<urllib3.connection.HTTPConnection?object?at?0x0000000003A6F048>:?Failed?to?establish?a?new?connection:?[WinError?10061]?由于目標計算機積極拒絕,無法連接。'))) During?handling?of?the?above?exception,?another?exception?occurred: Traceback?(most?recent?call?last): ??File?"D:/Study/工作/待解決問題/requests/requests_proxy.py",?line?15,?in?<module> ????response?=?requests.get(url=url,?headers=header,?proxies=free_proxy) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\api.py",?line?75,?in?get ????return?request('get',?url,?params=params,?**kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\api.py",?line?60,?in?request ????return?session.request(method=method,?url=url,?**kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\sessions.py",?line?533,?in?request ????resp?=?self.send(prep,?**send_kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\sessions.py",?line?646,?in?send ????r?=?adapter.send(request,?**kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\adapters.py",?line?510,?in?send ????raise?ProxyError(e,?request=request) requests.exceptions.ProxyError:?HTTPConnectionPool(host='182.34.33.38',?port=9999):?Max?retries?exceeded?with?url:?http://www.baidu.com/?(Caused?by?ProxyError('Cannot?connect?to?proxy.',?NewConnectionError('<urllib3.connection.HTTPConnection?object?at?0x0000000003A6F048>:?Failed?to?establish?a?new?connection:?[WinError?10061]?由于目標計算機積極拒絕,無法連接。')))

查過自己電腦網(wǎng)絡配置中沒有設置代理。

使用代理'123.206.54.52:8118'出現(xiàn)

ChunkedEncodingError

Traceback?(most?recent?call?last): ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\response.py",?line?397,?in?_error_catcher ????yield ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\response.py",?line?479,?in?read ????data?=?self._fp.read(amt) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?457,?in?read ????n?=?self.readinto(b) ??File?"D:\Software\python3.7.4\lib\http\client.py",?line?501,?in?readinto ????n?=?self.fp.readinto(b) ??File?"D:\Software\python3.7.4\lib\socket.py",?line?589,?in?readinto ????return?self._sock.recv_into(b) ConnectionResetError:?[WinError?10054]?遠程主機強迫關閉了一個現(xiàn)有的連接。 During?handling?of?the?above?exception,?another?exception?occurred: Traceback?(most?recent?call?last): ??File?"D:\Software\python3.7.4\lib\site-packages\requests\models.py",?line?750,?in?generate ????for?chunk?in?self.raw.stream(chunk_size,?decode_content=True): ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\response.py",?line?531,?in?stream ????data?=?self.read(amt=amt,?decode_content=decode_content) ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\response.py",?line?496,?in?read ????raise?IncompleteRead(self._fp_bytes_read,?self.length_remaining) ??File?"D:\Software\python3.7.4\lib\contextlib.py",?line?130,?in?__exit__ ????self.gen.throw(type,?value,?traceback) ??File?"D:\Software\python3.7.4\lib\site-packages\urllib3\response.py",?line?415,?in?_error_catcher ????raise?ProtocolError('Connection?broken:?%r'?%?e,?e) urllib3.exceptions.ProtocolError:?("Connection?broken:?ConnectionResetError(10054,?'遠程主機強迫關閉了一個現(xiàn)有的連接。',?None,?10054,?None)",?ConnectionResetError(10054,?'遠程主機強迫關閉了一個現(xiàn)有的連接。',?None,?10054,?None)) During?handling?of?the?above?exception,?another?exception?occurred: Traceback?(most?recent?call?last): ??File?"D:/Study/工作/待解決問題/requests/requests_proxy.py",?line?16,?in?<module> ????response?=?requests.get(url=url,?headers=header,?proxies=free_proxy) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\api.py",?line?75,?in?get ????return?request('get',?url,?params=params,?**kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\api.py",?line?60,?in?request ????return?session.request(method=method,?url=url,?**kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\sessions.py",?line?533,?in?request ????resp?=?self.send(prep,?**send_kwargs) ??File?"D:\Software\python3.7.4\lib\site-packages\requests\sessions.py",?line?686,?in?send ????r.content ??File?"D:\Software\python3.7.4\lib\site-packages\requests\models.py",?line?828,?in?content ????self._content?=?b''.join(self.iter_content(CONTENT_CHUNK_SIZE))?or?b'' ??File?"D:\Software\python3.7.4\lib\site-packages\requests\models.py",?line?753,?in?generate ????raise?ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError:?("Connection?broken:?ConnectionResetError(10054,?'遠程主機強迫關閉了一個現(xiàn)有的連接。',?None,?10054,?None)",?ConnectionResetError(10054,?'遠程主機強迫關閉了一個現(xiàn)有的連接。',?None,?10054,?None))

推薦閱讀:https://blog.csdn.net/wangzuxi/article/details/40377467??

最后,將url = 'http://www.baidu.com'?改成?url =?'https://www.baidu.com',?使用以上兩個代理地址測試都能成功,結果:200

-----

換了一個新的代理: 'http': '47.93.36.195:8118'?

url = 'http://www.baidu.com'?

多次運行,返回狀態(tài)有200,503,還有ChunkedEncodingError

由此可見,ChunkedEncodingError錯誤并不是代理問題,為穩(wěn)定,還是將url改為https為好。

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

分享名稱:PythonRequests:proxy代理錯誤-創(chuàng)新互聯(lián)
轉載來源:http://aaarwkj.com/article16/gjjdg.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供標簽優(yōu)化、定制開發(fā)、響應式網(wǎng)站、品牌網(wǎng)站制作、用戶體驗服務器托管

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設
天天爽天天看天天射天天操| 欧美欧美欧美欧美一二三区| 欧美三级伦理片免费观看| 97全国免费观看视频| 成人午夜福利视频大全| 蜜臀av一区二区在线观看| 婷婷色综合一区二区三区| 一区二区三区四区自拍偷拍视频 | 亚洲欧美日韩午夜在线| 成人激情电影免费在线| 视频在线免费观看97| 精品福利视频蜜臀91| 国产叼嘿一区二区视频| 有码不卡中文字幕在线视频| 国产91在线一区精品| 国产精品日本欧美一区二区| 欧美一级特黄免费大片| 国产麻豆成人传媒免费观看| 国产男女猛进猛出精品91| 熟女精品国产一区二区三区| 日本欧美精品一区二区精选| 亚洲av色男人天堂网| 麻豆映画传媒在线播放| 69国产精品久久久久久人| 日韩免费高清不卡视频| 久久久久久亚洲精品人妻| 91欧美精品午夜性色福利| 最新91精品手机国产在线| 国产精品国产精品三级在线观看| 国产精品国产三级专区| 日韩三级精品一区二区| 欧美性生活在线视频观看| 国产亚洲成人精品久久| 久久精品欧美日韩视频| 成人性生交大片免费男同| 国产欧美日韩精品久久久久久| 日韩精品一区二区三区高清| 在线不卡日本v二区| 国产亚洲精品免费视频| 国产亚洲一区二区三区在线| 综合久久—本道中文字幕|