Python paste.httpserver 模块,serve() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用paste.httpserver.serve()

项目:yt    作者:yt-project    | 项目源码 | 文件源码
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))
项目:verejne.digital    作者:verejnedigital    | 项目源码 | 文件源码
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)
项目:verejne.digital    作者:verejnedigital    | 项目源码 | 文件源码
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)
项目:verejne.digital    作者:verejnedigital    | 项目源码 | 文件源码
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)
项目:props    作者:gabrielStanovsky    | 项目源码 | 文件源码
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': []}
项目:props    作者:gabrielStanovsky    | 项目源码 | 文件源码
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))
项目:props    作者:gabrielStanovsky    | 项目源码 | 文件源码
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': []}
项目:props    作者:gabrielStanovsky    | 项目源码 | 文件源码
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))
项目:dabdabrevolution    作者:harryparkdotio    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
项目:dabdabrevolution    作者:harryparkdotio    | 项目源码 | 文件源码
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)
项目:gae_flex_pandas    作者:zdenulo    | 项目源码 | 文件源码
def main():
    from paste import httpserver
    httpserver.serve(app, host='127.0.0.1', port='8081')
项目:Mmrz-Sync    作者:zhanglintc    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:Mmrz-Sync    作者:zhanglintc    | 项目源码 | 文件源码
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)
项目:ynm3k    作者:socrateslee    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:ynm3k    作者:socrateslee    | 项目源码 | 文件源码
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)
项目:warriorframework    作者:warriorframework    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:warriorframework    作者:warriorframework    | 项目源码 | 文件源码
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)
项目:warriorframework    作者:warriorframework    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
项目:warriorframework    作者:warriorframework    | 项目源码 | 文件源码
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)
项目:touch-pay-client    作者:HackPucBemobi    | 项目源码 | 文件源码
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)
项目:touch-pay-client    作者:HackPucBemobi    | 项目源码 | 文件源码
def waitress(app, address, **options):
        from waitress import serve
        serve(app, host=address[0], port=address[1], _quiet=True)
项目:fgc    作者:mpaulweeks    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:fgc    作者:mpaulweeks    | 项目源码 | 文件源码
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)
项目:Orator-Google-App-Engine    作者:MakarenaLabs    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:Orator-Google-App-Engine    作者:MakarenaLabs    | 项目源码 | 文件源码
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)
项目:NebulaSolarDash    作者:toddlerya    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
项目:NebulaSolarDash    作者:toddlerya    | 项目源码 | 文件源码
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_beginner    作者:denzow    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
项目:bottle_beginner    作者:denzow    | 项目源码 | 文件源码
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)
项目:MCSManager-fsmodule    作者:Suwings    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet, **self.options)
项目:MCSManager-fsmodule    作者:Suwings    | 项目源码 | 文件源码
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)
项目:true_review_web2py    作者:lucadealfaro    | 项目源码 | 文件源码
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)
项目:true_review_web2py    作者:lucadealfaro    | 项目源码 | 文件源码
def waitress(app, address, **options):
        from waitress import serve
        serve(app, host=address[0], port=address[1], _quiet=True)
项目:base1k    作者:xiaq    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:base1k    作者:xiaq    | 项目源码 | 文件源码
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)
项目:SalesforceXyTools    作者:exiahuang    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:SalesforceXyTools    作者:exiahuang    | 项目源码 | 文件源码
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)
项目:yt    作者:yt-project    | 项目源码 | 文件源码
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 = Router()
        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': []}
项目:yt    作者:yt-project    | 项目源码 | 文件源码
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)
项目:Problematica-public    作者:TechMaz    | 项目源码 | 文件源码
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)
项目:Problematica-public    作者:TechMaz    | 项目源码 | 文件源码
def waitress(app, address, **options):
        from waitress import serve
        serve(app, host=address[0], port=address[1], _quiet=True)
项目:driveboardapp    作者:nortd    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:driveboardapp    作者:nortd    | 项目源码 | 文件源码
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)
项目:autoinjection    作者:ChengWiLL    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port, _quiet=self.quiet)
项目:autoinjection    作者:ChengWiLL    | 项目源码 | 文件源码
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)
项目:movies-python-py2neo-3.0    作者:neo4j-examples    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:movies-python-py2neo-3.0    作者:neo4j-examples    | 项目源码 | 文件源码
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)
项目:download-manager    作者:thispc    | 项目源码 | 文件源码
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)
项目:python-group-proj    作者:Sharcee    | 项目源码 | 文件源码
def run(self, handler):
        from waitress import serve
        serve(handler, host=self.host, port=self.port)
项目:python-group-proj    作者:Sharcee    | 项目源码 | 文件源码
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)