How to use the webserver.WebServer function in webserver

To help you get started, we’ve selected a few webserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bayandin / chromedriver / test / run_py_tests.py View on Github external
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)
github bayandin / chromedriver / test / run_py_tests.py View on Github external
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)
github bayandin / chromedriver / test / run_py_tests.py View on Github external
  @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)
github hasura / graphql-engine / server / tests-py / graphql_server.py View on Github external
def create_server(host='127.0.0.1', port=5000):
    return WebServer((host, port), handlers)
github bayandin / chromedriver / test / run_py_tests.py View on Github external
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)
github enesbcs / rpieasy / _C022_ESPNow.py View on Github external
@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:
github smeenka / esp32 / lolin32 / app / robonova / robonova_async.py View on Github external
#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")
github kanzure / pyphantomjs / pyphantomjs / phantom.py View on Github external
    @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
github kanzure / pyphantomjs / pyphantomjs / phantom.py View on Github external
    @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
github enesbcs / rpieasy / RPIEasy.py View on Github external
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