error in httplibs

Martin v. Loewis martin at v.loewis.de
Mon Oct 21 18:17:27 CEST 2002


Stéphane KLEIN <stephane_klein at yahoo.fr> writes:

> I would like resolve this problem

So please investigate it further: Which of the "in" operations cause
the trouble? What are the values of the various variables:

  print headers

(AFAICT, this is the only variable that is an input into this line of
code).

About the only way in which you could get an error is if headers was a
string and not a dictionary. If that is the case, where does headers
come from?:

  raise "HERE"

I must admit that the code looks bogus to me, wouldn't it be better if
it was

        if ('Host' in headers)
            or [k for k in headers.iterkeys() if k.lower() == "host"]:

instead?

Regards,
Martin



More information about the Python-list mailing list