[issue11280] urllib2 http_error_302 calls undefined "getheaders" method
Andres Riancho
report at bugs.python.org
Tue Feb 22 12:25:10 CET 2011
Andres Riancho <andres.riancho at gmail.com> added the comment:
Please take a deeper look. I think you're trusting the "old code" more than my bug report. Some things to keep in mind:
* The "headers" parameter is a dict. It will never have a getheaders method
* The If you search the whole urllib2.py file, you won't find instances of headers.getheaders(), you'll find headers.get() , as expected when using a dict.
Also, the call chain to this method is:
* def error(self, proto, *args)
* meth_name = 'http_error_%s' % proto
* args = (dict, proto, meth_name) + args
* return self._call_chain(*args)
* Where args comes from:
error('http', request, response, code, msg, hdrs)
* And the hdrs variable is set here:
code, msg, hdrs = response.code, response.msg, response.info()
* And as you know, the response object returns a dict when info() is called.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11280>
_______________________________________
More information about the Python-bugs-list
mailing list