Python: urllib2.URLError: <urlopen error [Errno 10060]
<p>I have some problem with reading some urls.</p>

<p>I try to use answer from this question <a href="http://stackoverflow.com/questions/5620263/using-an-http-proxy-python">Using an HTTP PROXY - Python </a> but it didn't help and I get an error <code>urllib2.URLError: &lt;urlopen error [Errno 10060]</code></p>

<p>I have a list of url</p>

<pre><code>yandex.ru/search?text=Ð°Ð²Ð¸ÑÐ¾&amp;lr=47
yandex.ru/search?text=ÑÐ²ÐµÑÐ¾Ðº%20ÐºÐ¸Ð´Ð´Ð¸Ð»ÐµÐ½Ð´%20Ð¼ÑÐ·ÑÐºÐ°Ð»ÑÐ½ÑÐ¹&amp;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
</code></pre>

<p>And code looks like </p>

<pre><code>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()
</code></pre>

<p>Also I try </p>

<pre><code>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)
</code></pre>

<p>And it returns me </p>

<pre><code>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&amp;lr=47 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('&lt;requests.packages.urllib3.connection.HTTPConnection object at 0x047D1090&gt;: 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-',)))
</code></pre>

<p>Where is error there? </p>

<p>Some of proxies didn't work.
And I use <code>urllib</code> instead <code>urllib2</code> and </p>

<pre><code>for url in urls:
    proxies = {'http': 'http://109.172.106.3:9999', 'http': 'http://62.113.208.183:3128', 'http': 'http://178.22.148.122:3129', 'http': 'http://217.17.46.162:3128'}
    url = 'http://www.' + url
    html = urllib.urlopen(url, proxies=proxies).read()
</code></pre>

<p>And it works for me</p>

python urllib2