"Jia CHEN" <jia.j.c...@foxmail.com> writes:

> I have the error below when trying to download the html content of a webpage. 
> I can open this webpage in a browser without any problem.

"Connection reset by peer" means that the other side (the HTTP server
in your case) has closed the connection.

It may have looked at the "User-Agent" request header to differentiate
between a browser request and an automated (script) request.

To work around this, you may provide a "User-Agent" header
to your "urllib2.Request" (see the documentation) letting
the "User-Agent" to look as if the request had been done by a browser
("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
indicates a firefoy).

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to