鱼C论坛

 找回密码
 立即注册
查看: 1475|回复: 4

55课 ip代理 报错了

[复制链接]
发表于 2019-8-4 07:37:26 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
换了好几次ip都报错
代码:

import urllib.request

#打开链接:https://www.xicidaili.com/nn/


url='http://www.whatismyip.com'



proxy_support=urllib.request.ProxyHandler({'http':'14.20.235.230:9797'})#放入查找到的ip

opener=urllib.request.build_opener(proxy_support)
opener.addheaders=[('User_Agent','Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.26 Safari/537.36 Core/1.63.5221.400 QQBrowser/10.0.1125.400')]

urllib.request.install_opener(opener)

response=urllib.request.urlopen(url)
html=response.read().decode('utf-8')
print(html)


报错:

Traceback (most recent call last):
  File "C:\Python36\lib\urllib\request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "C:\Python36\lib\http\client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Python36\lib\http\client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Python36\lib\http\client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Python36\lib\http\client.py", line 1026, in _send_output
    self.send(msg)
  File "C:\Python36\lib\http\client.py", line 964, in send
    self.connect()
  File "C:\Python36\lib\http\client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "C:\Python36\lib\socket.py", line 724, in create_connection
    raise err
  File "C:\Python36\lib\socket.py", line 713, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\python lianxi\8-3-1.py", line 17, in <module>
    response=urllib.request.urlopen(url)
  File "C:\Python36\lib\urllib\request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python36\lib\urllib\request.py", line 526, in open
    response = self._open(req, data)
  File "C:\Python36\lib\urllib\request.py", line 544, in _open
    '_open', req)
  File "C:\Python36\lib\urllib\request.py", line 504, in _call_chain
    result = func(*args)
  File "C:\Python36\lib\urllib\request.py", line 1346, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "C:\Python36\lib\urllib\request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2019-8-5 07:13:56 | 显示全部楼层
求助啊 不知道怎么办了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2019-8-7 09:07:31 | 显示全部楼层
没人吗
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-8-12 14:57:22 | 显示全部楼层
同问啊
  1. Traceback (most recent call last):
  2.   File "D:\Python\lib\urllib\request.py", line 1317, in do_open
  3.     encode_chunked=req.has_header('Transfer-encoding'))
  4.   File "D:\Python\lib\http\client.py", line 1229, in request
  5.     self._send_request(method, url, body, headers, encode_chunked)
  6.   File "D:\Python\lib\http\client.py", line 1275, in _send_request
  7.     self.endheaders(body, encode_chunked=encode_chunked)
  8.   File "D:\Python\lib\http\client.py", line 1224, in endheaders
  9.     self._send_output(message_body, encode_chunked=encode_chunked)
  10.   File "D:\Python\lib\http\client.py", line 1016, in _send_output
  11.     self.send(msg)
  12.   File "D:\Python\lib\http\client.py", line 956, in send
  13.     self.connect()
  14.   File "D:\Python\lib\http\client.py", line 1384, in connect
  15.     super().connect()
  16.   File "D:\Python\lib\http\client.py", line 932, in connect
  17.     self._tunnel()
  18.   File "D:\Python\lib\http\client.py", line 911, in _tunnel
  19.     message.strip()))
  20. OSError: Tunnel connection failed: 503 Service Unavailable

  21. During handling of the above exception, another exception occurred:

  22. Traceback (most recent call last):
  23.   File "D:/Python/python日志/切换代理.py", line 12, in <module>
  24.     response = urllib.request.urlopen(url)
  25.   File "D:\Python\lib\urllib\request.py", line 222, in urlopen
  26.     return opener.open(url, data, timeout)
  27.   File "D:\Python\lib\urllib\request.py", line 525, in open
  28.     response = self._open(req, data)
  29.   File "D:\Python\lib\urllib\request.py", line 543, in _open
  30.     '_open', req)
  31.   File "D:\Python\lib\urllib\request.py", line 503, in _call_chain
  32.     result = func(*args)
  33.   File "D:\Python\lib\urllib\request.py", line 1360, in https_open
  34.     context=self._context, check_hostname=self._check_hostname)
  35.   File "D:\Python\lib\urllib\request.py", line 1319, in do_open
  36.     raise URLError(err)
  37. urllib.error.URLError: <urlopen error Tunnel connection failed: 503 Service Unavailable>
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-8-13 11:05:28 | 显示全部楼层
代理ip有问题.多换几个试试
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-1-17 10:01

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表