Python中的Errno套接字错误
我写了这段代码:
import random
import sys
import urllib
openfile = open(sys.argv[1]).readlines()
c = random.choice(openfile)
i = 0
while i < 5:
i=i+1
c = random.choice(openfile)
proxies = {'http': c}
opener = urllib.FancyURLopener(proxies).open("http://whatismyip.com.au/").read()
::: 我把3个代理放在一个txt文件里:
http://211.161.159.74:8080
http://119.70.40.101:8080
http://124.42.10.119:8080
但是当我执行它的时候,我遇到了这个错误:
IOError: [Errno socket error] (10054, 'Connection reset by peer')
我该怎么办呢?请帮帮我。
1 个回答
2
你列出的第一个代理也让我在使用telnet时遇到了ECONNRESET的错误。你为什么觉得这些代理是有效的呢?顺便说一下,如果你想查找它们的DNS名称,它们是没有的。
$ dig -x 211.161.159.74
;; connection timed out; no servers could be reached