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


Python SimpleHTTPRequestHandler.handle方法代码示例

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


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

示例1: handle

# 需要导入模块: from http.server import SimpleHTTPRequestHandler [as 别名]
# 或者: from http.server.SimpleHTTPRequestHandler import handle [as 别名]
 def handle(self):
     # When using run_once, we have a single process, so
     # we cannot loop in BaseHTTPRequestHandler.handle; we
     # must return and handle new connections
     if self.run_once:
         self.handle_one_request()
     else:
         SimpleHTTPRequestHandler.handle(self)
开发者ID:virer,项目名称:vaw-router,代码行数:10,代码来源:vaw_websocket.py

示例2: handle

# 需要导入模块: from http.server import SimpleHTTPRequestHandler [as 别名]
# 或者: from http.server.SimpleHTTPRequestHandler import handle [as 别名]
 def handle(self):
     "Handle a request and, if anything has changed, rebuild the site."
     # overwrite the handle method in SimpleHTTPRequestHandler with this.
     # declare most_recent_time global; we'll be changing it later.
     global most_recent_time
     # figure out the most recent time edited in the source directory
     new_recent = most_recent()
     # only build the site if the new most recent is more recent than the
     # old one, i.e. if one or more of the files has been edited.
     if new_recent > most_recent_time:
         # update most_recent_time
         most_recent_time = new_recent
         # Build the site from the source directory
         print("Rebuilding your Cytoplasm site...")
         site.build()
     # Call SimpleHTTPRequestHandler.handle(), so it can do stuff there too.
     SimpleHTTPRequestHandler.handle(self)
开发者ID:pjv,项目名称:cytoplasm,代码行数:19,代码来源:server.py


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