MCPcopy Create free account
hub / github.com/NyarchLinux/DesktopPuppet / start_interaction_api

Function start_interaction_api

src/interaction_handler.py:125–141  ·  view source on GitHub ↗

Starts the HTTP API on a separate thread. Returns: httpd: The HTTPServer instance. server_thread: The thread running the server.

(interaction_server, host='localhost', port=8000)

Source from the content-addressed store, hash-verified

123
124
125def start_interaction_api(interaction_server, host='localhost', port=8000):
126 """
127 Starts the HTTP API on a separate thread.
128
129 Returns:
130 httpd: The HTTPServer instance.
131 server_thread: The thread running the server.
132 """
133 httpd = HTTPServer((host, port), InteractionHandler)
134 httpd.interaction_server = interaction_server
135 def serve():
136 print(f"Starting server on {host}:{port}")
137 httpd.serve_forever()
138
139 server_thread = threading.Thread(target=serve, daemon=True)
140 server_thread.start()
141 return httpd, server_thread
142
143def stop_interaction_api(httpd):
144 """

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected