DynAIkonTrap.server.web_serve#

Classes

Handler(callback, *args, **kwargs)

A handler class which inherits from http.server.SimpleHTTPRequestHandler.

ObservationServer(output_settings, ...)

The observation server handles HTML generation, running the HTTP server and starting the Shellinabox daemon.

ServiceHandler(shell_str)

A class to handle running a service daemon on a separate thread using subprocess.call.

class Handler(callback, *args, **kwargs)#

A handler class which inherits from http.server.SimpleHTTPRequestHandler. The method, do_GET() is overwritten to intercept GET requests for camera-fov.jpg.

do_GET()#

Serve a GET request.

class ObservationServer(output_settings: OutputSettings, logger_settings: LoggerSettings, read_image_from: Union[Camera, CameraToDisk])#

The observation server handles HTML generation, running the HTTP server and starting the Shellinabox daemon.

Initialises ObservationServer.

Parameters:
  • output_settings (OutputSettings) – Needs output_settings to determine the output directory to serve

  • logger_settings (LoggerSettings) – Needs logger_settings to determine the log file to serve

  • read_image_from (Union[Camera, CameraToDisk]) – Needs an object to read images from for FOV refresh

createFOVPage()#

Calls html_generator to make the FOV page.

createHomePage()#

Calls the html_generator to make the main page.

Creates a symbolic link to the log file so it’s accessible to the server

createObservationsHTML()#

Calls the html_generator to make the observations html.

createShellPage()#

Calls the html_generator to make the shell page.

get_ip()#

Simple method to get the IP address of this device. See: https://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib

run()#

Runs the server if the OS allows it, otherwise, error message is written to the log.

class ServiceHandler(shell_str: str)#

A class to handle running a service daemon on a separate thread using subprocess.call. Constructor takes a string, the command to be executed to start the daemon.

run_service()#