Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def respondWithUserAgentString(request):
return {}, """
%s
""" % request.GetHeader('User-Agent')
def respondWithUserAgentStringUseDeviceWidth(request):
return {}, """
%s
""" % request.GetHeader('User-Agent')
MobileEmulationCapabilityTest._http_server = webserver.WebServer(
chrome_paths.GetTestData())
MobileEmulationCapabilityTest._http_server.SetCallbackForPath(
'/userAgent', respondWithUserAgentString)
MobileEmulationCapabilityTest._http_server.SetCallbackForPath(
'/userAgentUseDeviceWidth', respondWithUserAgentStringUseDeviceWidth)
def respondWithUserAgentString(request):
return """
%s
""" % request.GetHeader('User-Agent')
def respondWithUserAgentStringUseDeviceWidth(request):
return """
%s
""" % request.GetHeader('User-Agent')
MobileEmulationCapabilityTest._http_server = webserver.WebServer(
chrome_paths.GetTestData())
MobileEmulationCapabilityTest._http_server.SetCallbackForPath(
'/userAgent', respondWithUserAgentString)
MobileEmulationCapabilityTest._http_server.SetCallbackForPath(
'/userAgentUseDeviceWidth', respondWithUserAgentStringUseDeviceWidth)
@staticmethod
def GlobalSetUp():
ChromeDriverTest._http_server = webserver.WebServer(
chrome_paths.GetTestData())
ChromeDriverTest._sync_server = webserver.SyncWebServer()
if _ANDROID_PACKAGE_KEY:
ChromeDriverTest._device = device_utils.DeviceUtils(
android_commands.GetAttachedDevices()[0])
http_host_port = ChromeDriverTest._http_server._server.server_port
sync_host_port = ChromeDriverTest._sync_server._server.server_port
forwarder.Forwarder.Map(
[(http_host_port, http_host_port), (sync_host_port, sync_host_port)],
ChromeDriverTest._device)
def create_server(host='127.0.0.1', port=5000):
return WebServer((host, port), handlers)
def respondWithUserAgentString(request):
return {}, """
%s
""" % request.GetHeader('User-Agent')
def respondWithUserAgentStringUseDeviceWidth(request):
return {}, """
%s
""" % request.GetHeader('User-Agent')
MobileEmulationCapabilityTest._http_server = webserver.WebServer(
chrome_paths.GetTestData())
MobileEmulationCapabilityTest._http_server.SetCallbackForPath(
'/userAgent', respondWithUserAgentString)
MobileEmulationCapabilityTest._http_server.SetCallbackForPath(
'/userAgentUseDeviceWidth', respondWithUserAgentStringUseDeviceWidth)
@webserver.WebServer.route('/espnow')
def handle_espnow(self):
try:
webserver.TXBuffer=""
if self.type == "GET":
responsearr = self.get
else:
responsearr = self.post
try:
managenode = webserver.arg('nodenum',responsearr)
except:
managenode = ""
try:
tasknum = int(webserver.arg('tasknum',responsearr))
except:
#klok.sync(now)
#klok.checkSummerWinter(now)
yield
if not connected:
log.warn("Unable to connect to ssid:%s. Starting AP led_klok ")
else:
pass
http = http_server.HttpServer("web")
port = 80
if sys.platform == "linux":
port = 8080
server = webserver.WebServer(http)
log.warn("Config tasks in the scheduler")
DATA_PORT = 1024
sched = asyncio.sched
sched.task(heap(), name = "heap", period = 10000)
sched.task(wlanConnect(), name = "wlan", period = 1000, time2run = 500)
sched.task(http.listen(port),name = "webServer",prio= 5)
sched.task(robonova_control.servoTask(),name = "servos", period=1000,time2run = 112,prio=20)
sched.enablePolling(100)
sched.enableGC(100)
log.info("All tasks loaded.. Start scheduler")
@pyqtSlot(result=WebServer)
def createWebServer(self):
server = WebServer(self)
self.m_servers.append(server)
# :TODO:
# page.applySettings(self.m_defaultPageSettings)
# page.libraryPath = os.path.dirname(os.path.abspath(self.m_scriptFile)
return server
@pyqtSlot(result=WebServer)
def createWebServer(self):
server = WebServer(self)
self.m_servers.append(server)
# :TODO:
# page.applySettings(self.m_defaultPageSettings)
# page.libraryPath = os.path.dirname(os.path.abspath(self.m_scriptFile)
return server
for p in ports:
up = p
try:
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind((socket.gethostname(), up))
serversocket.close()
except:
up = 0
if up>0:
break
if up == 0:
misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"Webserver can not be started, no available port found!")
else:
misc.addLog(rpieGlobals.LOG_LEVEL_INFO,"Webserver starting at port "+str(up))
Settings.WebUIPort = up
webserver.WebServer.start('', up) # starts webserver GUI