Add logging to the gateway detection process

This commit is contained in:
SpaceSaver 2023-09-22 16:26:29 -04:00
parent cbb3a8f43b
commit 7ea5949fcf

View file

@ -15,8 +15,12 @@ GATEWAY = "22223333"
def register(push_token: bytes, no_parse = False, gateway = None) -> tuple[str, bytes]: def register(push_token: bytes, no_parse = False, gateway = None) -> tuple[str, bytes]:
"""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...")
mccmnc = requests.get(f"http://{PHONE_IP}:{API_PORT}/info").text mccmnc = requests.get(f"http://{PHONE_IP}:{API_PORT}/info").text
print("MCC+MNC received! " + mccmnc)
print("Determining gateway...")
gateway = gateway_fetch.getGatewayMCCMNC(mccmnc) gateway = gateway_fetch.getGatewayMCCMNC(mccmnc)
print("Gateway found! " + gateway)
if gateway is None: if gateway is None:
print("Automatic gateway detection failed, switching to default...") print("Automatic gateway detection failed, switching to default...")
gateway = GATEWAY gateway = GATEWAY