From f91da304d8b02e3f05eff7982a51e11c1711e390 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Sat, 30 Jul 2022 12:54:16 +0100 Subject: [PATCH] replacement of ipv4_address with conditional swapped to ```wifi.radio.ipv4_address if wifi.radio.ipv4_address else wifi.radio.ipv4_address_ap``` --- wsgiserver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wsgiserver.py b/wsgiserver.py index abcd4b2..0bfbd5e 100755 --- a/wsgiserver.py +++ b/wsgiserver.py @@ -155,7 +155,7 @@ def start(self): invoked on receiving an incoming request. """ self._server_sock = pool.socket(pool.AF_INET, pool.SOCK_STREAM) - self._server_sock.bind((repr(wifi.radio.ipv4_address), self.port)) + self._server_sock.bind((repr(wifi.radio.ipv4_address if wifi.radio.ipv4_address else wifi.radio.ipv4_address_ap), self.port)) self._server_sock.listen(1) # if self._debug: @@ -170,7 +170,8 @@ def pretty_ip(self): """ Return a "pretty" representation of the current local IP. """ - return f"http://{wifi.radio.ipv4_address}:{self.port}" + ipaddress = wifi.radio.ipv4_address if wifi.radio.ipv4_address else wifi.radio.ipv4_address_ap + return f"http://{ipaddress}:{self.port}" def update_poll(self): """ @@ -275,7 +276,7 @@ def _get_environ(self, client): env["REQUEST_METHOD"] = method env["SCRIPT_NAME"] = "" - env["SERVER_NAME"] = str(wifi.radio.ipv4_address) + env["SERVER_NAME"] = str(wifi.radio.ipv4_address if wifi.radio.ipv4_address else wifi.radio.ipv4_address_ap) env["SERVER_PROTOCOL"] = ver env["SERVER_PORT"] = self.port if path.find("?") >= 0: