8000 Don't pass 'smtp' to application factory · python/webhook-mailer@eaee5e0 · GitHub
[go: up one dir, main page]

Skip to content< 8000 /a>

Commit eaee5e0

Browse files
committed
Don't pass 'smtp' to application factory
1 parent 78d4a66 commit eaee5e0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mailer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ async def handler(request):
132132
return handler
133133

134134

135-
def application(loop, smtp):
135+
def application(loop):
136136
app = aiohttp.web.Application(loop=loop)
137137
app.router.add_post('/', create_handler(
138138
lambda: aiohttp.ClientSession(loop=loop),
139-
lambda: smtp,
139+
# TODO: remove use_tls=False if we won't use starttls
140+
lambda: aiosmtplib.SMTP(hostname=SMTP_HOSTNAME, port=SMTP_PORT, loop=loop, use_tls=False),
140141
))
141142
return app
142143

143144
if __name__ == '__main__':
144145
loop = asyncio.get_event_loop()
145-
smtp = aiosmtplib.SMTP(hostname=SMTP_HOSTNAME, port=SMTP_PORT, loop=loop, use_tls=False)
146-
app = application(loop, smtp)
146+
app = application(loop)
147147
aiohttp.web.run_app(app, port=PORT)

0 commit comments

Comments
 (0)
0