Trouble with proxies

Jeremy Hylton jeremy at cnri.reston.va.us
Sat May 1 17:25:39 EDT 1999


>>>>> "BF" == Bruce Fletcher <befletch at my-dejanews.com> writes:

  BF> Ok, I have expanded my test and come up with some interesting
  BF> results.  I'm using IDLE now too, if that matters.  Slick
  BF> program.  Anyway, consider the following script:

[...]
 f = urllib.urlopen('http://www.ibm.com/')

 print f

 data = f.readline()
[...]

  BF> No matter which proxy string I use, or which URL, I get the
  BF> following:

  BF>  <addinfourl at 9536416 whose fp = <socket._fileobject instance
  BF> at 916b20>> <HEAD><TITLE>403 Forbidden</TITLE></HEAD>

  BF>  <BODY><H1>403 Forbidden</H1>

  BF>  <P>The request was not properly formatted.  A possible security
  BF> risk detected.</P>

It would be helpful to see the HTTP headers as well.  Can you try it
with the following:

f = urllib.urlopen('http://www.python.org/')
msg = f.info()
for hdr in msg.headers:
    print hdr,
data = f.readline()

THis may shed a little more light on what specifically is the
problem.  I agree with Guido, though, that the proxy server is
generating the error message.

Jeremy




More information about the Python-list mailing list