def client(): db_fd, db_fl = tempfile.mkstemp() db = DB_Manager_SQLite(db_fl) db.set_test_db() server = WebServer(db) server.start() yield server.get_app() os.close(db_fd) os.unlink(db_fl)
self.data_reading = None self.email = None if not isfile(CONFIG_FILENAME): print("Creating config file \"" + CONFIG_FILENAME + "\" ...") self.web_credentials = {"username": "******", "password": "******"} self.data_reading = { "number_of_channels": 8, "measure_timeout": 10, "dates_per_file": 360 } self.email = { "enabled": False, "sender": "*****@*****.**", "receiver": "*****@*****.**", "server": "smtp.gmail.com:465", "credentials": { "username": "", "password": "" } } self.save_to_file() else: self.load_from_file() bms = BatteryManagementSystem() server = WebServer(bms) bms.start() server.start()
import sys from signal import signal, SIGINT from server import WebServer def shutdown_server(sig, unused): web_server.shutdown() sys.exit(1) signal(SIGINT, shutdown_server) web_server = WebServer(8081) print("Use Ctrl+C to shut down server") web_server.start()
import signal import sys from server import WebServer def shutdownServer(sig, unused): webserver.shutdown() sys.exit(1) signal.signal(signal.SIGINT, shutdownServer) webserver = WebServer(12000) webserver.start() print("Press Ctrl+C to shut down server")
from server import WebServer from client_handler import WalabotHandler handler = WalabotHandler() s = WebServer(port=8888, handler=handler.commandsHandler) s.start()
#!/usr/bin/python from camera import Camera from server import WebServer PORT = 8080 RESOLUTION = 'VGA' QUALITY = 30 FRAMERATE = 30 cam = Camera(RESOLUTION,QUALITY,FRAMERATE) ws = WebServer(cam,PORT,'0.0.0.0') # start camera Thread cam.start() #blocking ws.start() cam.stop()