문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top