當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。