diff --git a/networkconfig.py b/networkconfig.py index f2b8bf6..1e702f4 100644 --- a/networkconfig.py +++ b/networkconfig.py @@ -48,7 +48,8 @@ def handle_root(client): wlan_sta.active(True) ssids = sorted(ssid.decode('utf-8') for ssid, *_ in wlan_sta.scan()) - response_header = """\ + response = [] + response.append("""\

@@ -58,20 +59,18 @@ def handle_root(client):
- """ + """) - response_variable = [] for ssid in ssids: - response_variable.append("""\ + response.append("""\ """.format(ssid)) - response_variable = "\n".join(response_variable) - response_footer = """\ + response.append("""\ @@ -106,8 +105,8 @@ def handle_root(client): - """ - send_response(client, response_header + response_variable + response_footer) + """) + send_response(client, "\n".join(response)) def handle_configure(client, request): @@ -129,7 +128,7 @@ def handle_configure(client, request): return False if do_connect(ssid, password): - response_footer = """\ + response = """\


@@ -142,7 +141,7 @@ def handle_configure(client, request):
""" % dict(ssid=ssid) - send_response(client, response_footer) + send_response(client, response) try: with open("passwd.dat", "r") as f: ex_data = f.read() @@ -153,7 +152,7 @@ def handle_configure(client, request): f.write(ex_data) return True else: - response_footer = """\ + response = """\

@@ -167,8 +166,8 @@ def handle_configure(client, request):

- """ % dict(ssid=ssid) - send_response(client, response_footer) + """ % dict(ssid=ssid) + send_response(client, response) return False
{0}
Password: