@@ -77,6 +77,7 @@ def is_session_valid(self) -> bool:
77
77
async def connect (self ) -> dict :
78
78
"""Connect to VivintSky Cloud Service."""
79
79
if not (self .__has_custom_client_session and self .is_session_valid ()):
80
+ assert self .__password
80
81
await self .__get_vivintsky_session (self .__username , self .__password )
81
82
authuser_data = await self .get_authuser_data ()
82
83
if not authuser_data :
@@ -91,7 +92,7 @@ async def disconnect(self) -> None:
91
92
async def verify_mfa (self , code : str ) -> None :
92
93
"""Verify multi-factor authentication code."""
93
94
self .__mfa_pending = False
94
- endpoint = f" { AUTH_ENDPOINT } /idp/api/{ "validate" if self .__mfa_type == "code" else "submit" } "
95
+ endpoint = f' { AUTH_ENDPOINT } /idp/api/{ "validate" if self .__mfa_type == "code" else "submit" } '
95
96
resp = await self .__post (
96
97
endpoint ,
97
98
params = {"client_id" : "ios" },
@@ -105,6 +106,7 @@ async def verify_mfa(self, code: str) -> None:
105
106
)
106
107
if resp and "url" in resp :
107
108
resp = await self .__get (path = f"{ AUTH_ENDPOINT } { resp ['url' ]} " )
109
+ assert resp
108
110
109
111
if "location" in resp :
110
112
query = urllib .parse .urlparse (resp ["location" ]).query
@@ -501,6 +503,7 @@ async def __get_vivintsky_session(self, username: str, password: str) -> None:
501
503
},
502
504
allow_redirects = False ,
503
505
)
506
+ assert resp
504
507
505
508
if "location" in resp and redirect_uri in resp ["location" ]:
506
509
query = urllib .parse .urlparse (resp ["location" ]).query
@@ -517,6 +520,7 @@ async def __get_vivintsky_session(self, username: str, password: str) -> None:
517
520
},
518
521
data = json .dumps ({"username" : username , "password" : password }),
519
522
)
523
+ assert resp
520
524
521
525
# Check for TOTP/MFA requirement
522
526
if "validate" in resp :
@@ -648,6 +652,7 @@ async def _send_grpc(
648
652
) -> None :
649
653
"""Send gRPC."""
650
654
assert self .is_session_valid ()
655
+ assert self .__token
651
656
creds = grpc .ssl_channel_credentials ()
652
657
653
658
async with grpc .aio .secure_channel (GRPC_ENDPOINT , credentials = creds ) as channel :
0 commit comments