Increase timeout to 30s

This commit is contained in:
Kasherpete 2023-10-03 21:34:13 -05:00 committed by GitHub
parent c0e532ace2
commit 2daa402ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ def register(push_token: bytes, no_parse = False, gateway = None) -> tuple[str,
"""Forwards a registration request to the phone and returns the phone number, signature for the provided push token""" """Forwards a registration request to the phone and returns the phone number, signature for the provided push token"""
if gateway is None: if gateway is None:
print("Requesting device MCC+MNC for gateway detection...") print("Requesting device MCC+MNC for gateway detection...")
mccmnc = requests.get(f"http://{PHONE_IP}:{API_PORT}/info").text mccmnc = requests.get(f"http://{PHONE_IP}:{API_PORT}/info", timeout=30).text
print("MCC+MNC received! " + mccmnc) print("MCC+MNC received! " + mccmnc)
print("Determining gateway...") print("Determining gateway...")
gateway = gateway_fetch.getGatewayMCCMNC(mccmnc) gateway = gateway_fetch.getGatewayMCCMNC(mccmnc)
@ -30,7 +30,7 @@ def register(push_token: bytes, no_parse = False, gateway = None) -> tuple[str,
req_id = random.randint(0, 2**32) req_id = random.randint(0, 2**32)
sms = f"REG-REQ?v=3;t={token};r={req_id};" sms = f"REG-REQ?v=3;t={token};r={req_id};"
print("Sending message and waiting for response...") print("Sending message and waiting for response...")
r = requests.get(f"http://{PHONE_IP}:{API_PORT}/register", params={"sms": sms, "gateway": gateway}, timeout=16) r = requests.get(f"http://{PHONE_IP}:{API_PORT}/register", params={"sms": sms, "gateway": gateway}, timeout=30)
print("Received response from device!") print("Received response from device!")
if no_parse: if no_parse:
print("Now do the next part and rerun with --pdu") print("Now do the next part and rerun with --pdu")