class documentation

Simple HTTP Server for MicroPython WiFi Devices

Method __del__ Close the server and release resources.
Method __init__ Initialize the server.
Method add_route Register a new route with its handler.
Method close Close the server and client connections.
Method run Run the server to accept and handle incoming connections.
Method start Start the server on the specified port.
Method webpage Generate a basic HTML page.
Instance Variable append_question_mark Undocumented
Instance Variable client Undocumented
Instance Variable http_type Undocumented
Instance Variable last_response Undocumented
Instance Variable routes Undocumented
Instance Variable server Undocumented
Instance Variable view_manager Undocumented
Property is_running Check if the server is running.
def __del__(self):

Close the server and release resources.

def __init__(self, view_manager, append_question_mark=True):

Initialize the server.

Parameters
view_manager:ViewManagerThe view manager instance for display and storage access.
append_question_mark:boolWhether to append '?' to URLs. Defaults to True.
def add_route(self, path, handler, method='GET'):

Register a new route with its handler.

Parameters
path:strURL path (e.g. "/custom").
handler:callableFunction to handle the route, returning the HTML response as a string.
method:strHTTP method (e.g. "GET", "POST"). Defaults to "GET".
def close(self, reason=None):

Close the server and client connections.

Parameters
reason:str or NoneLog message for the close reason. Defaults to None.
def run(self):

Run the server to accept and handle incoming connections.

def start(self, port=80) -> bool:

Start the server on the specified port.

Parameters
port:intThe port to listen on. Defaults to 80.
Returns
boolTrue if the server started, False on failure.
def webpage(self):

Generate a basic HTML page.

Returns
strThe generated HTML page.
append_question_mark =

Undocumented

client =

Undocumented

http_type: str =

Undocumented

last_response =

Undocumented

routes =

Undocumented

server =

Undocumented

view_manager =

Undocumented

@property
is_running: bool =

Check if the server is running.

Returns
boolTrue if the server socket is open, False otherwise.