diff --git a/skyvern/core/totp.py b/skyvern/core/totp.py index 49cf3515..36366a46 100644 --- a/skyvern/core/totp.py +++ b/skyvern/core/totp.py @@ -108,6 +108,8 @@ async def _get_verification_code_from_url( totp_verification_url=url, reason=str(e), ) + if not json_resp: + return None return json_resp.get("verification_code", None) diff --git a/skyvern/forge/sdk/core/aiohttp_helper.py b/skyvern/forge/sdk/core/aiohttp_helper.py index 002a7b89..ce5d3ed8 100644 --- a/skyvern/forge/sdk/core/aiohttp_helper.py +++ b/skyvern/forge/sdk/core/aiohttp_helper.py @@ -137,7 +137,7 @@ async def aiohttp_post( timeout: int = DEFAULT_REQUEST_TIMEOUT, raise_exception: bool = True, retry_timeout: float = 0, -) -> dict[str, Any]: +) -> dict[str, Any] | None: async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=timeout)) as session: count = 0 while count <= retry: diff --git a/skyvern/services/otp_service.py b/skyvern/services/otp_service.py index 7f76e9e8..37d8b8d7 100644 --- a/skyvern/services/otp_service.py +++ b/skyvern/services/otp_service.py @@ -142,6 +142,9 @@ async def _get_otp_value_from_url( totp_verification_url=url, reason=str(e), ) + if not json_resp: + return None + code = json_resp.get("verification_code", None) if code: return OTPValue(value=code, type=OTPType.TOTP)