Adafruit_CircuitPython_HTTP.../examples/httpserver_simpletest_auto_connection_manager.py
2025-05-16 16:11:43 +00:00

22 lines
531 B
Python

# SPDX-FileCopyrightText: 2024 DJDevon3
#
# SPDX-License-Identifier: MIT
import wifi
from adafruit_connection_manager import get_radio_socketpool
from adafruit_httpserver import Request, Response, Server
pool = get_radio_socketpool(wifi.radio)
server = Server(pool, "/static", debug=True)
@server.route("/")
def base(request: Request):
"""
Serve a default static plain text message.
"""
return Response(request, "Hello from the CircuitPython HTTP Server!")
server.serve_forever(str(wifi.radio.ipv4_address))