Pergunta

I would like to multithread sending mail (using django's SMTPConnection or perhaps the smtplib module). I was hoping there was a module similar to urllib2 where I can:

import eventlet
from eventlet.green import urllib2

except using smtplib instead of the urllib2 import. However, this does to appear to supported. I read this could monkey patched(?), but I am unsure how to proceed. Any ideas how this can be accomplished with eventlets? Or do I have to drop down into the python Thread class, etc.

Foi útil?

Solução

Use

import eventlet
eventlet.monkey_patch()
import module

Or

module = eventlet.import_patched(module)

Either should work for you.

http://eventlet.net/doc/patching.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top