Skip to content

Commit 0dc5662

Browse files
committed
simplify nested if statements
1 parent c7d7b56 commit 0dc5662

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,15 @@ def _extract_token_expiry_date(self, response_data: Mapping[str, Any]) -> Airbyt
327327
expires_in = self._find_and_get_value_from_response(
328328
response_data, self.get_expires_in_name()
329329
)
330-
# If the access token expires in is None, we do not know when the token will expire
331-
if expires_in is None:
332-
# If the token expiry date is set and the token is not expired, continue using the existing token expiry date
333-
if self.get_token_expiry_date() and not self.token_has_expired():
334-
return self.get_token_expiry_date()
335-
else:
336-
return self._default_token_expiry_date()
337-
else:
330+
if expires_in is not None:
338331
return self._parse_token_expiration_date(expires_in)
332+
333+
# expires_in is None
334+
existing_expiry_date = self.get_token_expiry_date()
335+
if existing_expiry_date and not self.token_has_expired():
336+
return existing_expiry_date
337+
338+
return self._default_token_expiry_date()
339339

340340
def _find_and_get_value_from_response(
341341
self,

0 commit comments

Comments
 (0)