Skip to content

Commit 81d1b2b

Browse files
authored
Merge pull request #218 from seleniumbase/google-auth-update
Minor change to Google Auth timing
2 parents 79a3d3d + c881beb commit 81d1b2b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,22 +2539,22 @@ def get_google_auth_password(self, totp_key=None):
25392539
If "totp_key" is not specified, defaults to using the one
25402540
provided in seleniumbase/config/settings.py
25412541
Google Auth passwords expire and change at 30-second intervals.
2542-
If the fetched password expires in the next 3 seconds, waits
2543-
for a fresh one before returning it (may take up to 3 seconds).
2542+
If the fetched password expires in the next 1.5 seconds, waits
2543+
for a new one before returning it (may take up to 1.5 seconds).
25442544
See https://pyotp.readthedocs.io/en/latest/ for details. """
25452545
import pyotp
25462546
if not totp_key:
25472547
totp_key = settings.TOTP_KEY
25482548

25492549
epoch_interval = time.time() / 30.0
25502550
cycle_lifespan = float(epoch_interval) - int(epoch_interval)
2551-
if float(cycle_lifespan) > 0.90:
2552-
# Password expires in less than 3 seconds. Wait for a fresh one.
2553-
for i in range(60):
2551+
if float(cycle_lifespan) > 0.95:
2552+
# Password expires in the next 1.5 seconds. Wait for a new one.
2553+
for i in range(30):
25542554
time.sleep(0.05)
25552555
epoch_interval = time.time() / 30.0
25562556
cycle_lifespan = float(epoch_interval) - int(epoch_interval)
2557-
if not float(cycle_lifespan) > 0.90:
2557+
if not float(cycle_lifespan) > 0.95:
25582558
# The new password cycle has begun
25592559
break
25602560

0 commit comments

Comments
 (0)