This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bmiller
Recipients ajaksu2, barry, beazley, bmiller, georg.brandl, jhylton, jjlee, orsenthil
Date 2009-03-27.01:00:25
SpamBayes Score 3.14193e-14
Marked as misclassified No
Message-id <>
In-reply-to <>
On Thu, Mar 26, 2009 at 4:29 PM, Barry A. Warsaw <>wrote:

> Barry A. Warsaw <> added the comment:
> I propose that you only document the getitem header access API.  I.e.
> the thing that info() gives you can be used to access the message
> headers via message['content-type'].  That's an API common to both
> rfc822.Messages (the ultimate base class of mimetools.Message) and
> email.message.Message.

As I've found myself in the awkward position of having to explain the new
3.0 api to my students I've thought about this and have some
I'm also willing to help with the documentation or any enhancements.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'addinfourl' object is unsubscriptable

I wish I new what an addinfourl object was.

'Fri, 27 Mar 2009 00:41:34 GMT'

'Fri, 27 Mar 2009 00:41:34 GMT'

['Date', 'Server', 'Last-Modified', 'ETag', 'Accept-Ranges',
'Content-Length', 'Connection', 'Content-Type']

Using x.headers over  makes the most sense to me, but I don't know
that I can give any good rationale.  Which would we want to document?

'text/html; charset=ISO-8859-1'

I guess technically this is correct since the charset is part of the
Content-Type header in HTTP but it does make life difficult for what I think
will be a pretty common use case in this new urllib:  read from the url (as
bytes) and then decode them into a string using the appropriate character

As you follow this road, you have the confusing option of these three calls:

>>> x.headers.get_charsets()

I think it should be a bug that get_charset() does not return anything in
this case.  It is not at all clear why get_content_charset() and
get_charset() should have different behavior.


> ----------
> nosy: +barry
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
File name Uploaded
unnamed bmiller, 2009-03-27.01:00:18
Date User Action Args
2009-03-27 01:00:27bmillersetrecipients: + bmiller, jhylton, barry, georg.brandl, beazley, jjlee, orsenthil, ajaksu2
2009-03-27 01:00:26bmillerlinkissue4773 messages
2009-03-27 01:00:25bmillercreate