in pages/desktop/frontend/login.py [0:0]
def get_verification_code(self, mail):
request = requests.get(f"https://restmail.net/mail/{mail}", timeout=10)
response = request.json()
# creating a timed loop to address a possible communication delay between
# FxA and restmail; this loop polls the endpoint for 20s to await a response
# and exits if there was no response received in the given amount of time
timeout_start = time.time()
while time.time() < timeout_start + 20:
if response:
verification_code = [
key["headers"]["x-verify-short-code"] for key in response
]
return verification_code
elif not response:
requests.get(f"https://restmail.net/mail/{mail}", timeout=10)
print("Restmail did not receive an email from FxA")
return self