0
Ich habe ein Problem mit dem Lesen einiger URLs.Python: urllib2.URLError: <urlopen error [Errno 10060]
Ich versuche Using an HTTP PROXY - Python Antwort auf dieser Frage zu verwenden, aber es hat nicht geholfen und ich erhalte eine Fehlermeldung urllib2.URLError: <urlopen error [Errno 10060]
Ich habe eine Liste von URL-
yandex.ru/search?text=авито&lr=47
yandex.ru/search?text=цветок%20киддиленд%20музыкальный&lr=47
dns-shop.ru/product/c7bf1138670f3361/rul-hori-racing-wheel
dns-shop.ru/product/c7bf1138670f3361/rul-hori-racing-wheel#opinion
kaluga.onlinetrade.ru/catalogue/ruli_dgoystiki_geympadi-c31/hori/reviews/rul_hori_racing_wheel_controller_ps_4_ps4_020e_acps440-274260.html
kazan.onlinetrade.ru/catalogue/ruli_dgoystiki_geympadi-c31/hori/reviews/rul_hori_racing_wheel_controller_xboxone_xbox_005u_acxone34-274261.html
ebay.com
Und Code sieht aus wie
for url in urls:
proxy = urllib2.ProxyHandler({"http":"http://61.233.25.166:80"})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
try:
html = urllib2.urlopen(url).read()
except ValueError or urllib2:
url = 'http://www.' + url
html = urllib2.urlopen(url).read()
Auch ich versuche
s = requests.Session()
s.proxies = {"http": "http://61.233.25.166:80"}
for url in urls:
url = 'http://www.' + url
r = s.get(url)
print(r.text)
Und es gibt mir
requests.exceptions.ProxyError: HTTPConnectionPool(host='61.233.25.166', port=80): Max retries exceeded with url: http://www.yandex.ru/search?text=%D0%B8%D0%B3%D1%80%D1%83%D1%88%D0%BA%D0%B0%20%22%D0%B2%D0%B5%D1%81%D0%B5%D0%BB%D0%B0%D1%8F%20%D0%B3%D1%83%D1%81%D0%B5%D0%BD%D0%B8%D1%86%D0%B0%22%20keenway%20%D0%BE%D1%82%D0%B7%D1%8B%D0%B2%D1%8B&lr=47 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x047D1090>: Failed to establish a new connection: [Errno 10060] \xcf\xee\xef\xfb\xf2\xea\xe0 \xf3\xf1\xf2\xe0\xed\xee\xe2\xe8\xf2\xfc \xf1\xee\xe5\xe4\xe8\xed\xe5\xed\xe8\xe5 \xe1\xfb\xeb\xe0 \xe1\xe5\xe7\xf3\xf1\xef\xe5\xf8\xed\xee\xe9, \xf2.\xea. \xee\xf2 \xe4\xf0\xf3\xe3\xee\xe3\xee \xea\xee\xec\xef\xfc\xfe\xf2\xe5\xf0\xe0 \xe7\xe0 \xf2\xf0\xe5\xe1\xf3\xe5\xec\xee\xe5 \xe2\xf0\xe5\xec\xff \xed\xe5 \xef\xee\xeb\xf3\xf7\xe5\xed \xed\xf3\xe6\xed\xfb\xe9 \xee\xf2\xea\xeb\xe8\xea, \xe8\xeb\xe8 \xe1\xfb\xeb\xee \xf0\xe0\xe7\xee\xf0\xe2\xe0\xed\xee \xf3\xe6\xe5 \xf3\xf1\xf2\xe0\xed\xee\xe2\xeb\xe5\xed\xed\xee\xe5 \xf1\xee\xe5\xe4\xe8\xed\xe5\xed\xe8\xe5 \xe8\xe7-',)))
Wo gibt es Fehler?
Nun heißt es in der Fehlermeldung 'Verursacht durch ProxyError (" Es kann keine Verbindung proxy.'' und Ihre Proxy gibt 'Time to Live übertroffen zu pingen .. –
@BarisDemiray Ich habe versucht, nicht auf diese Weise, um mein Problem zu lösen. Ich versuche auch 'urllib2' und jetzt' proxy_info = { 'Benutzer': 'Login', 'pass': 'passwd' , 'host': "proxyadresse", 'port': 8080 } proxy_supp ort = urllib2.ProxyHandler ({"http": "http: //% (benutzer) s:% (pass) s @% (host) s:% (port) d"% proxy_info}) opener = urllib2.build_opener (proxy_support, urllib2.HTTPHandler) 'aber es gibt mir' urllib2.URLError zurück: '. Ich kann nicht verstehen, wo ein Fehler: in Proxy, dass ich oder in Art von URL angeben? –