Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Filetypes in email attachments.

Reply
Thread Tools

Filetypes in email attachments.

 
 
justin.vanwinkle@gmail.com
Guest
Posts: n/a
 
      08-25-2005
Hello everyone,

I'm writing a simple spam filter as a project, partly to learn python.
I want to filter by filetype, however, the mime content type I get
using .get_content_type gives limited and possibly bogus information,
especially when trying to detect viruses or spam.

I would like to use the magic file to detect the filetype, if this is
possible. I have the attachement stored and (generally) decoded in a
variable.

Justin

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
Guest
Posts: n/a
 
      08-25-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I would like to use the magic file to detect the filetype, if this is
> possible. I have the attachement stored and (generally) decoded in a
> variable.


There is a Python binding to the libmagic library, see

http://mx.gw.com/pipermail/file/2003/000055.html

Meanwhile, this binding is part of the standard file(1) distribution.

Regards,
Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
argparse and filetypes Bradley Hintze Python 2 03-22-2011 03:52 PM
askopenfilename filetypes problem embirath Python 0 07-02-2010 04:50 PM
parsing directory for certain filetypes royG Python 11 03-11-2008 01:45 PM
tkFileDialog.askopenfilename filetypes problem Justin Straube Python 2 09-27-2006 08:48 PM
Accessing/Dowloading certain filetypes... Brandon ASP General 2 01-18-2006 04:57 PM



Advertisments