smtplib upload progress

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Oct 19 23:24:33 EDT 2009


En Mon, 19 Oct 2009 19:33:50 -0300, Guyon Morée <guyon.moree at gmail.com>  
escribió:

> I wanted to use smtplib to send a bunch of files. All good, except I
> cant monitor the upload progress as far as I can see.
>
> So I monkey patched the SMTP.sendall method, which chops up the data
> and keeps calling a provided callback for every chunk of data sent.
>
> This feels kind of dirty and I was wondering what my other options are
> to tackle this seemingly simple problem.

(there is no sendall method in SMTP, but send)
Looks like there is no other way... perhaps I'd have overriden data()  
instead of send(), but it's as dirty as yours, one has to duplicate the  
original code.
I don't know how often the need arises or how useful would this be to  
others, but you could submit a patch to http://bugs.python.org/

-- 
Gabriel Genellina




More information about the Python-list mailing list