@@ -81,6 +81,7 @@ async def fetch_diff(client, url):
81
81
async def send_email (smtp , message ):
82
82
async with smtp as server :
83
83
await server .connect ()
84
+ print ('Login:' , SMTP_USERNAME , SMTP_PASSWORD )
84
85
await server .login (SMTP_USERNAME , SMTP_PASSWORD )
85
86
return (await server .send_message (message ))
86
87
@@ -129,11 +130,7 @@ async def handler(request):
129
130
return handler
130
131
131
132
132
- def application (loop = None , smtp = None ):
133
- if loop is None :
134
- loop = asyncio .get_event_loop ()
135
- if smtp is None :
136
- smtp = aiosmtplib .SMTP (hostname = SMTP_HOSTNAME , port = SMTP_PORT , loop = loop , use_tls = False )
133
+ def application (loop , smtp ):
137
134
app = aiohttp .web .Application (loop = loop )
138
135
app .router .add_post ('/' , create_handler (
139
136
lambda : aiohttp .ClientSession (loop = loop ),
@@ -144,5 +141,6 @@ def application(loop=None, smtp=None):
144
141
if __name__ == '__main__' :
145
142
loop = asyncio .get_event_loop ()
146
143
smtp = aiosmtplib .SMTP (hostname = SMTP_HOSTNAME , port = SMTP_PORT , loop = loop , use_tls = False )
144
+ print ('SMTP:' , SMTP_HOSTNAME , SMTP_PORT )
147
145
app = application (loop , smtp )
148
146
aiohttp .web .run_app (app , port = PORT )
0 commit comments