From 2a69745c4ae82ec8269b0eead3c2a550f6bc2f28 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 2 Oct 2023 11:31:25 +0200 Subject: [PATCH] API - minor refacto --- fittrackee/emails/email.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fittrackee/emails/email.py b/fittrackee/emails/email.py index 5a6ef3be..b2ff619e 100644 --- a/fittrackee/emails/email.py +++ b/fittrackee/emails/email.py @@ -132,7 +132,7 @@ class EmailService: parsed_url = parse_url(email_url) if parsed_url.scheme != 'smtp': raise InvalidEmailUrlScheme() - credentials = ( + username, password = ( parsed_url.auth.split(':') if parsed_url.auth else [None, None] # type: ignore @@ -140,11 +140,11 @@ class EmailService: return { 'host': parsed_url.host, 'port': 25 if parsed_url.port is None else parsed_url.port, - 'use_tls': True if parsed_url.query == 'tls=True' else False, - 'use_ssl': True if parsed_url.query == 'ssl=True' else False, - 'username': credentials[0], + 'use_tls': parsed_url.query == 'tls=True', + 'use_ssl': parsed_url.query == 'ssl=True', + 'username': username, 'password': ( - None if credentials[1] is None else unquote(credentials[1]) + unquote(password) if isinstance(password, str) else password ), }