Skip to content

Commit 2675766

Browse files
committed
Hardcode Google Voice SMTP transport
1 parent 2de98b2 commit 2675766

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

src/quant_platform_kit/notifications/strategy_plugin_google_voice.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@
1818
from .email import parse_email_recipients, send_smtp_email
1919

2020

21+
_GOOGLE_VOICE_SMTP_HOST = "smtp.gmail.com"
22+
_GOOGLE_VOICE_SMTP_PORT = 465
23+
_GOOGLE_VOICE_SMTP_STARTTLS = False
24+
_GOOGLE_VOICE_SMTP_SSL = True
25+
26+
2127
@dataclass(frozen=True)
2228
class StrategyPluginGoogleVoiceSettings:
2329
gateway_recipients: tuple[str, ...] = ()
2430
gmail_user: str | None = None
2531
gmail_app_password: str | None = field(default=None, repr=False)
26-
smtp_host: str = "smtp.gmail.com"
27-
smtp_port: int = 465
28-
use_starttls: bool = False
29-
use_ssl: bool = True
3032
timeout: float = 10.0
3133

3234
@classmethod
@@ -276,14 +278,14 @@ def _send_message(
276278
sent = send_notification(
277279
subject=message.subject,
278280
body=message.body,
279-
smtp_host=settings.smtp_host,
280-
smtp_port=settings.smtp_port,
281+
smtp_host=_GOOGLE_VOICE_SMTP_HOST,
282+
smtp_port=_GOOGLE_VOICE_SMTP_PORT,
281283
sender=settings.gmail_user,
282284
recipients=settings.gateway_recipients,
283285
username=settings.gmail_user,
284286
password=settings.gmail_app_password,
285-
use_starttls=settings.use_starttls,
286-
use_ssl=settings.use_ssl,
287+
use_starttls=_GOOGLE_VOICE_SMTP_STARTTLS,
288+
use_ssl=_GOOGLE_VOICE_SMTP_SSL,
287289
timeout=settings.timeout,
288290
)
289291
except Exception as exc:

tests/test_google_voice_notifications.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,4 @@ def test_google_voice_settings_reads_google_voice_gmail_names_only():
170170
assert settings.gmail_user == "sender@gmail.com"
171171
assert settings.gateway_recipients == ("gateway@txt.voice.google.com",)
172172
assert settings.gmail_app_password == "app-password"
173-
assert settings.smtp_host == "smtp.gmail.com"
174-
assert settings.smtp_port == 465
175-
assert settings.use_ssl is True
176-
assert settings.use_starttls is False
177173
assert settings.missing_fields() == ()

0 commit comments

Comments
 (0)