API - minor refacto
This commit is contained in:
parent
4dc36cceec
commit
2a69745c4a
@ -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
|
||||
),
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user