This commit is contained in:
Maxim Devaev
2023-01-24 06:38:02 +02:00
parent 065a8facc5
commit 736f370be5
4 changed files with 26 additions and 6 deletions
+13
View File
@@ -32,6 +32,19 @@ print(requests.get(
).text)
```
Since in the borderline case of the 2FA code lifetime, the code may be invalid,
it makes sense to either handle error 403 by repeating the request in seconds.
A more correct way is to combine this method and check the remaining lifetime
and postpone the request if there is a second or so left. You can find out how much
time is left in this way:
```python
totp = pyotp.TOTP(secret)
now = int(time.time())
remaining = now - (now % totp.interval)
```
### Single request auth