Generating zipped or gzipped attachment with email package?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri May 22 04:03:56 EDT 2009


En Thu, 21 May 2009 10:34:09 -0300, <skip at pobox.com> escribió:

> I want to modify my script to automatically zip or gzip files which  
> exceed
> some size threshold.  Doing the zip/gzip dance is no problem.  I'm  
> concerned
> about how to specify that properly with the email package.  For example,
> consider a large CSV file.  I figure out the MIME type is text/csv.  Now
> suppose I gzip the file before attaching it.  How would this code change  
> to
> specify the compression where "path" is now compressed?

HTTP uses the Content-Coding: gzip header field, but I think there is no  
equivalent in MIME :(
I'm afraid you'll have to declare the attachment as a gzipped file, and  
let the user manually unzip and handle the contained csv file.

-- 
Gabriel Genellina




More information about the Python-list mailing list