Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90528 > unrolled thread

Re: urllib2.urlopen error "socket.error: [Errno 104] Connection reset by peer"

Started bydieter <dieter@handshake.de>
First post2015-05-13 07:55 +0200
Last post2015-05-13 07:55 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: urllib2.urlopen error "socket.error: [Errno 104] Connection reset by peer" dieter <dieter@handshake.de> - 2015-05-13 07:55 +0200

#90528 — Re: urllib2.urlopen error "socket.error: [Errno 104] Connection reset by peer"

Fromdieter <dieter@handshake.de>
Date2015-05-13 07:55 +0200
SubjectRe: urllib2.urlopen error "socket.error: [Errno 104] Connection reset by peer"
Message-ID<mailman.431.1431496532.12865.python-list@python.org>
"Jia CHEN" <jia.j.chen@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).

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web