handle NONE type in http response (#3795)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user