On 10/13/2012 11:55 PM, Brian van den Broek wrote: > On 14 October 2012 02:15, Ray Jones <crawlz...@gmail.com> wrote: >> On 10/13/2012 07:50 PM, Steven D'Aprano wrote: > <snip> > >>> If you can do `print e.info()`, then you can also do `info = e.info()` >>> and inspect the info programmatically. >>> >> One would expect that to be true. But when I do info = e.info(), info is >> <httplib.HTTPMessage instance at 0x85bdd2c>. >> >> When I print e.info(), I get the following: >> >> Content-Type: text/html >> Connection: close >> WWW-Authenticate: Basic realm="xxxx" >> Content-Length: xx >> >> I can iterate through e.info() with a 'for' loop, but all I get as a >> result is: >> >> connection >> content-type >> www-authenticate >> content-length >> >> In other words, I get the headers but not the corresponding values. > Ray, > > That smells rather like you are dealing with a dictionary. What > happens if you try > e.info()["connection"] Bingo! That's it! Thank-you very much - I will now attempt to implement it.
Ray _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor