Open drmaniak opened 11 months ago
Seems related to https://github.com/scrapy/scrapy/issues/3478
Spidermon uses scrapy.mail.EmailSender
to send emails using SMTP protocol. Such class returns a Deferred object that is never awaited and caused the error logs that you are raising. To fix this we either need to:
cc. @Gallaecio @wRAR @rennerocha
The analysis makes sense. Blocking until the deferred finishes should be fine if the code allows doing it easily.
It doesn't look trivial to block on a deferred or rebuild spidermon to support async code, so we should change the current action to use some other smtp library like https://docs.python.org/3/library/smtplib.html instead.
Rebuild spidermon to support async code would be a Spidermon 2.0 change. I don't think we are considering this in short term :smile:
Using blocking Python stlib smtplib
for that looks fine to me, and not complicated to do.
Description
When using the
SendSmtpEmail
class from Spidermon, even though the email is sent successfully, an error is thrown by the Twisted framework. I followed the syntax from the latest Spidermon docs.Code
Spidermon Email configuration (in settings.py)
Error Logs
Environment
Scrapy Version: 2.10.0 Spidermon Version: 1.19.0 Twisted Version: 22.10.0 Python Version: 3.9 OS: WSL2 (Ubuntu 22.04)