urllib.open('http://www.redherring.com/')

apederse at my-deja.com apederse at my-deja.com
Fri Feb 9 02:48:21 EST 2001


In article <95tq9r$afs$1 at nnrp1.deja.com>,
  Greg Jorgensen <gregj at pobox.com> wrote:
> In article <3A825A68.B1023097 at intertrader.com>,
>   Andrew Cooke <andrew at intertrader.com> wrote:
> >
> > Maybe they're checking an HTTP header line and only responding to
> known
> > browsers?
>
> I tried sending some standard headers, but it still hung and then came
> back with "connection reset by peer."
>
> ``````````````````````````````````
> import httplib
>
> h = httplib.HTTP("redherring.com")
> h.connect()
> h.putrequest("GET","/")
> h.putheader("Accept", "text/html")
> h.putheader("Accept", "text/plain")
> h.putheader("User-Agent", "Mozilla/4.08 [en] (Windows NT 5.0)")
> h.putheader("Accept", "image/gif, image/jpeg")
> h.putheader("Accept-Language", "en")
> h.putheader("Accept-Charset", "iso-8859-1,*,utf-8")
> h.endheaders()
>
> errcode, errmsg, headers = h.getreply()
> f = h.getfile()
> s = f.read()
> f.close()
>
> print h
> print "content length: %d" % len(s)
> ``````````````````````````````````````````
>
> --
> Greg Jorgensen
> Portland, Oregon, USA
> gregj at pobox.com
>
> Sent via Deja.com
> http://www.deja.com/
>

to me it looks like the problem lies whithin python itself? is there any
point in reporting such bugs when everyone will soon be using python 2.0
anyway?

/Asle


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list