python类serve()的实例源码

bottle.py 文件源码 项目:yt 作者: yt-project 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def handle(self, url, method):
        """ Execute the handler bound to the specified url and method and return
        its output. If catchall is true, exceptions are catched and returned as
        HTTPError(500) objects. """
        if not self.serve:
            return HTTPError(503, "Server stopped")
        try:
            handler, args = self.match_url(url, method)
            return handler(**args)
        except HTTPResponse as e:
            return e
        except Exception as e:
            if isinstance(e, (KeyboardInterrupt, SystemExit, MemoryError))\
            or not self.catchall:
                raise
            return HTTPError(500, 'Unhandled exception', e, format_exc(10))
server.py 文件源码 项目:verejne.digital 作者: verejnedigital 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--listen',
                    help='host:port to listen on',
                    default='127.0.0.1:8083')
  args = parser.parse_args()
  host, port = args.listen.split(':')

  app = webapp2.WSGIApplication([
      ('/kataster_info_location', KatasterInfoLocation),
      ('/kataster_info_company', KatasterInfoCompany),
      ('/kataster_info_person', KatasterInfoPerson),
      ('/kataster_info_politician', KatasterInfoPolitician),
      ('/list_politicians', ListPoliticians),
      ('/info_politician', InfoPolitician),
      ('/asset_declarations', AssetDeclarations),
      ], debug=False)

  httpserver.serve(
      app,
      host=host,
      port=port)
serving.py 文件源码 项目:verejne.digital 作者: verejnedigital 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def main():
  app = webapp2.WSGIApplication(
          [
           ('/obstaravanie', ServeObstaravanie),
           ('/obstaravanieFirma', ServeCompany),
           ('/notifications', ServeNotifications),
           ('/updateNotifications', UpdateNotifications),
          ], debug=False)

  parser = argparse.ArgumentParser()
  parser.add_argument('--listen',
                    help='host:port to listen on',
                    default='127.0.0.1:8082')
  args = parser.parse_args()
  host, port = args.listen.split(':')

  httpserver.serve(
      app,
      host=host,
      port=port)
server.py 文件源码 项目:verejne.digital 作者: verejnedigital 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def main():
  app = webapp2.WSGIApplication([
      ('/connection', Connection),
      ('/shortest', ShortestPath),
      ('/neighbourhood', Neighbourhood)
      ], debug=False)

  parser = argparse.ArgumentParser()
  parser.add_argument('--listen',
                    help='host:port to listen on',
                    default='127.0.0.1:8081')
  args = parser.parse_args()
  host, port = args.listen.split(':')

  httpserver.serve(
      app,
      host=host,
      port=port)
bottle.py 文件源码 项目:props 作者: gabrielStanovsky 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, catchall=True, autojson=True, config=None):
        """ Create a new bottle instance.
            You usually don't do that. Use `bottle.app.push()` instead.
        """
        self.routes = [] # List of installed routes including metadata.
        self.callbacks = {} # Cache for wrapped callbacks.
        self.router = Router() # Maps to self.routes indices.

        self.mounts = {}
        self.error_handler = {}
        self.catchall = catchall
        self.config = config or {}
        self.serve = True
        self.castfilter = []
        if autojson and json_dumps:
            self.add_filter(dict, dict2json)
        self.hooks = {'before_request': [], 'after_request': []}
bottle.py 文件源码 项目:props 作者: gabrielStanovsky 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def handle(self, environ):
        """ Execute the handler bound to the specified url and method and return
        its output. If catchall is true, exceptions are catched and returned as
        HTTPError(500) objects. """
        if not self.serve:
            return HTTPError(503, "Server stopped")
        try:
            handler, args = self.match(environ)
            return handler(**args)
        except HTTPResponse, e:
            return e
        except Exception, e:
            if isinstance(e, (KeyboardInterrupt, SystemExit, MemoryError))\
            or not self.catchall:
                raise
            return HTTPError(500, 'Unhandled exception', e, format_exc(10))
bottle.py 文件源码 项目:props 作者: gabrielStanovsky 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, catchall=True, autojson=True, config=None):
        """ Create a new bottle instance.
            You usually don't do that. Use `bottle.app.push()` instead.
        """
        self.routes = [] # List of installed routes including metadata.
        self.callbacks = {} # Cache for wrapped callbacks.
        self.router = Router() # Maps to self.routes indices.

        self.mounts = {}
        self.error_handler = {}
        self.catchall = catchall
        self.config = config or {}
        self.serve = True
        self.castfilter = []
        if autojson and json_dumps:
            self.add_filter(dict, dict2json)
        self.hooks = {'before_request': [], 'after_request': []}
bottle.py 文件源码 项目:props 作者: gabrielStanovsky 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def handle(self, environ):
        """ Execute the handler bound to the specified url and method and return
        its output. If catchall is true, exceptions are catched and returned as
        HTTPError(500) objects. """
        if not self.serve:
            return HTTPError(503, "Server stopped")
        try:
            handler, args = self.match(environ)
            return handler(**args)
        except HTTPResponse, e:
            return e
        except Exception, e:
            if isinstance(e, (KeyboardInterrupt, SystemExit, MemoryError))\
            or not self.catchall:
                raise
            return HTTPError(500, 'Unhandled exception', e, format_exc(10))
bottle.py 文件源码 项目:dabdabrevolution 作者: harryparkdotio 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
bottle.py 文件源码 项目:dabdabrevolution 作者: harryparkdotio 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self, handler):  # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler,
                         host=self.host,
                         port=str(self.port), **self.options)
main.py 文件源码 项目:gae_flex_pandas 作者: zdenulo 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def main():
    from paste import httpserver
    httpserver.serve(app, host='127.0.0.1', port='8081')
bottle.py 文件源码 项目:Mmrz-Sync 作者: zhanglintc 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
bottle.py 文件源码 项目:Mmrz-Sync 作者: zhanglintc 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self, handler): # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options)
bottle.py 文件源码 项目:ynm3k 作者: socrateslee 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
bottle.py 文件源码 项目:ynm3k 作者: socrateslee 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def run(self, handler): # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options)
bottle.py 文件源码 项目:warriorframework 作者: warriorframework 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
bottle.py 文件源码 项目:warriorframework 作者: warriorframework 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self, handler): # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options)
bottle.py 文件源码 项目:warriorframework 作者: warriorframework 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
bottle.py 文件源码 项目:warriorframework 作者: warriorframework 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self, handler):  # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler,
                         host=self.host,
                         port=str(self.port), **self.options)
anyserver.py 文件源码 项目:touch-pay-client 作者: HackPucBemobi 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def paste(app, address, **options):
        options = {}
        from paste import httpserver
        from paste.translogger import TransLogger
        httpserver.serve(app, host=address[0], port=address[1], **options)
anyserver.py 文件源码 项目:touch-pay-client 作者: HackPucBemobi 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def waitress(app, address, **options):
        from waitress import serve
        serve(app, host=address[0], port=address[1], _quiet=True)
bottle.py 文件源码 项目:fgc 作者: mpaulweeks 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
bottle.py 文件源码 项目:fgc 作者: mpaulweeks 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self, handler): # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options)
bottle.py 文件源码 项目:Orator-Google-App-Engine 作者: MakarenaLabs 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
bottle.py 文件源码 项目:Orator-Google-App-Engine 作者: MakarenaLabs 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self, handler): # pragma: no cover
        from paste import httpserver
        if not self.quiet:
            from paste.translogger import TransLogger
            handler = TransLogger(handler)
        httpserver.serve(handler, host=self.host, port=str(self.port),
                         **self.options)
bottle.py 文件源码 项目:NebulaSolarDash 作者: toddlerya 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
bottle.py 文件源码 项目:NebulaSolarDash 作者: toddlerya 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run(self, handler):  # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler,
                         host=self.host,
                         port=str(self.port), **self.options)
bottle.py 文件源码 项目:bottle_beginner 作者: denzow 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
bottle.py 文件源码 项目:bottle_beginner 作者: denzow 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def run(self, handler):  # pragma: no cover
        from paste import httpserver
        from paste.translogger import TransLogger
        handler = TransLogger(handler, setup_console_handler=(not self.quiet))
        httpserver.serve(handler,
                         host=self.host,
                         port=str(self.port), **self.options)
bottle.py 文件源码 项目:MCSManager-fsmodule 作者: Suwings 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)


问题


面经


文章

微信
公众号

扫码关注公众号