Possible Duplicate:
How to find the mime type of a file in python?
I'm using an email processing API (sendgrid.com) that posts all incoming emails to a web request handler in my app. The attachments are posted as attachment0=xyz&attachment1=abc along with other email fields like 'to' 'cc' 'subject', etc...
I then store these attachments as files in the BlobStore (with App Engine). To serve these files back to the user, the mime_type/content_type must be specified. As I understand it, it is usually dependent on the file type. But it's not clear to me how to get the file type from the passed strings.
Is there a library that figures out the file type from the byte content of a file?
Just to clarify, there is no filename or file extension. Just the file's byte content.