当前位置: 首页>>代码示例>>Python>>正文


Python webapp.WSGIApplication方法代码示例

本文整理汇总了Python中google.appengine.ext.webapp.WSGIApplication方法的典型用法代码示例。如果您正苦于以下问题:Python webapp.WSGIApplication方法的具体用法?Python webapp.WSGIApplication怎么用?Python webapp.WSGIApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在google.appengine.ext.webapp的用法示例。


在下文中一共展示了webapp.WSGIApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def main(*loaders):
  """Starts bulk upload.

  Raises TypeError if not, at least one Loader instance is given.

  Args:
    loaders: One or more Loader instance.
  """
  if not loaders:
    raise TypeError('Expected at least one argument.')

  for loader in loaders:
    if not isinstance(loader, Loader):
      raise TypeError('Expected a Loader instance; received %r' % loader)

  application = webapp.WSGIApplication([('.*', BulkLoad)])
  wsgiref.handlers.CGIHandler().run(application) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:19,代码来源:bulkload_deprecated.py

示例2: create_handlers_map

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def create_handlers_map():
  """Create new handlers map.

  Returns:
    list of (regexp, handler) pairs for WSGIApplication constructor.
  """
  pipeline_handlers_map = []

  if pipeline:
    pipeline_handlers_map = pipeline.create_handlers_map(prefix=".*/pipeline")

  return pipeline_handlers_map + [
      # Task queue handlers.
      (r".*/worker_callback", handlers.MapperWorkerCallbackHandler),
      (r".*/controller_callback", handlers.ControllerCallbackHandler),
      (r".*/kickoffjob_callback", handlers.KickOffJobHandler),
      (r".*/finalizejob_callback", handlers.FinalizeJobHandler),

      # RPC requests with JSON responses
      # All JSON handlers should have /command/ prefix.
      (r".*/command/start_job", handlers.StartJobHandler),
      (r".*/command/cleanup_job", handlers.CleanUpJobHandler),
      (r".*/command/abort_job", handlers.AbortJobHandler),
      (r".*/command/list_configs", status.ListConfigsHandler),
      (r".*/command/list_jobs", status.ListJobsHandler),
      (r".*/command/get_job_detail", status.GetJobDetailHandler),

      # UI static files
      (STATIC_RE, status.ResourceHandler),

      # Redirect non-file URLs that do not end in status/detail to status page.
      (r".*", RedirectHandler),
      ] 
开发者ID:elsigh,项目名称:browserscope,代码行数:35,代码来源:main.py

示例3: create_application

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def create_application():
  """Create new WSGIApplication and register all handlers.

  Returns:
    an instance of webapp.WSGIApplication with all mapreduce handlers
    registered.
  """
  return webapp.WSGIApplication(create_handlers_map(),
                                debug=True) 
开发者ID:elsigh,项目名称:browserscope,代码行数:11,代码来源:main.py

示例4: callback_application

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def callback_application(self):
    """WSGI application for handling the OAuth 2.0 redirect callback.

    If you need finer grained control use `callback_handler` which returns just
    the webapp.RequestHandler.

    Returns:
      A webapp.WSGIApplication that handles the redirect back from the
      server during the OAuth 2.0 dance.
    """
    return webapp.WSGIApplication([
        (self.callback_path, self.callback_handler())
        ]) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:15,代码来源:appengine.py

示例5: create_handlers_map

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def create_handlers_map():
  """Create new handlers map.

  Returns:
    list of (regexp, handler) pairs for WSGIApplication constructor.
  """
  pipeline_handlers_map = []

  if pipeline:
    pipeline_handlers_map = pipeline.create_handlers_map(prefix=".*/pipeline")

  return pipeline_handlers_map + [
      # Task queue handlers.
      # Always suffix by mapreduce_id or shard_id for log analysis purposes.
      # mapreduce_id or shard_id also presents in headers or payload.
      (r".*/worker_callback.*", handlers.MapperWorkerCallbackHandler),
      (r".*/controller_callback.*", handlers.ControllerCallbackHandler),
      (r".*/kickoffjob_callback.*", handlers.KickOffJobHandler),
      (r".*/finalizejob_callback.*", handlers.FinalizeJobHandler),

      # RPC requests with JSON responses
      # All JSON handlers should have /command/ prefix.
      (r".*/command/start_job", handlers.StartJobHandler),
      (r".*/command/cleanup_job", handlers.CleanUpJobHandler),
      (r".*/command/abort_job", handlers.AbortJobHandler),
      (r".*/command/list_configs", status.ListConfigsHandler),
      (r".*/command/list_jobs", status.ListJobsHandler),
      (r".*/command/get_job_detail", status.GetJobDetailHandler),

      # UI static files
      (STATIC_RE, status.ResourceHandler),

      # Redirect non-file URLs that do not end in status/detail to status page.
      (r".*", RedirectHandler),
      ] 
开发者ID:singhj,项目名称:locality-sensitive-hashing,代码行数:37,代码来源:main.py

示例6: main

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def main():
  """Main program. Run the auth checking middleware wrapped WSGIApplication."""
  util.run_bare_wsgi_app(app) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:5,代码来源:ui.py

示例7: new_factory

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def new_factory(cls, *args, **kwargs):
    """Create new request handler factory.

    Use factory method to create reusable request handlers that just
    require a few configuration parameters to construct.  Also useful
    for injecting shared state between multiple request handler
    instances without relying on global variables.  For example, to
    create a set of post handlers that will do simple text transformations
    you can write:

      class ChangeTextHandler(webapp.RequestHandler):

        def __init__(self, transform):
          self.transform = transform

        def post(self):
          response_text = self.transform(
              self.request.request.body_file.getvalue())
          self.response.out.write(response_text)

      application = webapp.WSGIApplication(
          [('/to_lower', ChangeTextHandler.new_factory(str.lower)),
           ('/to_upper', ChangeTextHandler.new_factory(str.upper)),
          ],
          debug=True)

    Text POSTed to /to_lower will be lower cased.
    Text POSTed to /to_upper will be upper cased.
    """
    def new_instance():
      return cls(*args, **kwargs)
    new_instance.__name__ = cls.__name__ + 'Factory'
    return new_instance 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:35,代码来源:_webapp25.py

示例8: __init__

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def __init__(self, url_mapping, debug=False):
    """Initializes this application with the given URL mapping.

    Args:
      url_mapping: list of (URI regular expression, RequestHandler) pairs
                   (e.g., [('/', ReqHan)])
      debug: if true, we send Python stack traces to the browser on errors
    """
    self._init_url_mappings(url_mapping)
    self.__debug = debug


    WSGIApplication.active_instance = self
    self.current_request_args = () 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:16,代码来源:_webapp25.py

示例9: __call__

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def __call__(self, environ, start_response):
    """Called by WSGI when a request comes in."""
    request = self.REQUEST_CLASS(environ)
    response = self.RESPONSE_CLASS()


    WSGIApplication.active_instance = self


    handler = None
    groups = ()
    for regexp, handler_class in self._url_mapping:
      match = regexp.match(request.path)
      if match:
        try:
          handler = handler_class()



          handler.initialize(request, response)
        except Exception, e:
          if handler is None:
            handler = RequestHandler()
          handler.response = response
          handler.handle_exception(e, self.__debug)
          response.wsgi_write(start_response)
          return ['']
        groups = match.groups()
        break 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:31,代码来源:_webapp25.py

示例10: CreateApplication

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def CreateApplication():
  """Create new WSGIApplication and register all handlers.

  Returns:
    an instance of webapp.WSGIApplication with all mapreduce handlers
    registered.
  """
  return webapp.WSGIApplication([(r'.*', RedirectToAdminConsole)],
                                debug=True) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:11,代码来源:main.py

示例11: get

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def get(self, prefix, name):
    """GET request handler.

    Typically the arguments are passed from the matching groups in the
    URL pattern passed to WSGIApplication().

    Args:
      prefix: The zipfilename without the .zip suffix.
      name: The name within the zipfile.
    """
    self.ServeFromZipFile(prefix + '.zip', name) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:13,代码来源:__init__.py

示例12: main

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def main():
  """Main program.

  This is invoked when this package is referenced from app.yaml.
  """
  application = webapp.WSGIApplication([('/([^/]+)/(.*)', ZipHandler)])
  util.run_wsgi_app(application) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:9,代码来源:__init__.py

示例13: create_handlers_map

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def create_handlers_map():
  """Create new handlers map.

  Returns:
    list of (regexp, handler) pairs for WSGIApplication constructor.
  """
  pipeline_handlers_map = []

  if pipeline:
    pipeline_handlers_map = pipeline.create_handlers_map(prefix=".*/pipeline")

  return pipeline_handlers_map + [



      (r".*/worker_callback.*", handlers.MapperWorkerCallbackHandler),
      (r".*/controller_callback.*", handlers.ControllerCallbackHandler),
      (r".*/kickoffjob_callback.*", handlers.KickOffJobHandler),
      (r".*/finalizejob_callback.*", handlers.FinalizeJobHandler),



      (r".*/command/start_job", handlers.StartJobHandler),
      (r".*/command/cleanup_job", handlers.CleanUpJobHandler),
      (r".*/command/abort_job", handlers.AbortJobHandler),
      (r".*/command/list_configs", status.ListConfigsHandler),
      (r".*/command/list_jobs", status.ListJobsHandler),
      (r".*/command/get_job_detail", status.GetJobDetailHandler),


      (STATIC_RE, status.ResourceHandler),


      (r".*", RedirectHandler),
      ] 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:37,代码来源:main.py

示例14: main

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def main():
  application = webapp.WSGIApplication([('/blogs', ListBlogs), 
                                        ('/write_post', WritePost)],
      debug=True)
  wsgiref.handlers.CGIHandler().run(application) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:7,代码来源:blogapp.py

示例15: main

# 需要导入模块: from google.appengine.ext import webapp [as 别名]
# 或者: from google.appengine.ext.webapp import WSGIApplication [as 别名]
def main():
  application = webapp.WSGIApplication([('/', MainPage),
                                        ('/get_oauth_token', OAuthDance),
                                        ('/fetch_data', FetchData),
                                        ('/revoke_token', RevokeToken)],
                                        debug=True)
  run_wsgi_app(application) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:9,代码来源:main_rsa.py


注:本文中的google.appengine.ext.webapp.WSGIApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。