Add a timeout between requests to get a key

This commit is contained in:
Stepan Zhukovsky 2022-09-25 19:06:53 +09:00
parent 7747ea7d9f
commit f41b79b647

View File

@ -3,6 +3,7 @@
__author__ = 'MOIS3Y' __author__ = 'MOIS3Y'
import requests import requests
from time import sleep
from models_vm import VmAccount from models_vm import VmAccount
from models_dci import AuthUser from models_dci import AuthUser
from settings import CLIENT_HOST, PLATFORM from settings import CLIENT_HOST, PLATFORM
@ -82,9 +83,10 @@ class Access(object):
answer = req.json() answer = req.json()
key = answer['key'] key = answer['key']
print("Key will be used:") print("Key will be used:")
print(key, "\n") print(answer, "\n")
break break
except Exception: except Exception:
sleep(2)
check_key += 1 check_key += 1
key = 'not_found_try_again' key = 'not_found_try_again'
return key return key