當前位置: 首頁>>代碼示例>>Python>>正文


Python RequestHandler.flush方法代碼示例

本文整理匯總了Python中cyclone.web.RequestHandler.flush方法的典型用法代碼示例。如果您正苦於以下問題:Python RequestHandler.flush方法的具體用法?Python RequestHandler.flush怎麽用?Python RequestHandler.flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cyclone.web.RequestHandler的用法示例。


在下文中一共展示了RequestHandler.flush方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: flush

# 需要導入模塊: from cyclone.web import RequestHandler [as 別名]
# 或者: from cyclone.web.RequestHandler import flush [as 別名]
    def flush(self, include_footers=False):
        """
        This method is used internally by Cyclone,
        Cyclone specify the function on_finish but in that time the request is already flushed,
        so overwrite flush() was the easiest way to achieve our collection.

        It's here implemented to supports the I/O logging if requested
        with the command line options --io $number_of_request_recorded
        """
        if hasattr(self, 'globaleaks_io_debug'):
            try:
                content = ("<" * 15)
                content += (" Response %d " % self.globaleaks_io_debug)
                content += ("<" * 15) + "\n\n"
                content += "status code: " + str(self._status_code) + "\n\n"

                content += "headers:\n"
                for k, v in self._headers.iteritems():
                    content += "%s: %s\n" % (k, v)

                if self._write_buffer is not None:
                    content += "\nbody: " + str(self._write_buffer) + "\n"

                self.do_verbose_log(content)
            except Exception as excep:
                log.err("JSON logging fail (flush): %s" % excep.message)
                return

        RequestHandler.flush(self, include_footers)
開發者ID:globaleaks,項目名稱:GLBackend-outdated,代碼行數:31,代碼來源:base.py

示例2: flush

# 需要導入模塊: from cyclone.web import RequestHandler [as 別名]
# 或者: from cyclone.web.RequestHandler import flush [as 別名]
    def flush(self, include_footers=False):
        """
        This method is used internally by Cyclone,
        Cyclone specify the function on_finish but in that time the request is already flushed,
        so overwrite flush() was the easiest way to achieve our collection.

        It's here implemented to supports the I/O logging if requested
        with the command line options --io $number_of_request_recorded
        """
        from globaleaks.event import outcoming_event_monitored, EventTrack


        # This is the event tracker, used to keep track of the
        # outcome of the events.
        if not hasattr(self, '_status_code'):
            if GLSetting.devel_mode:
                log.debug("Developer, check this out")
                import pdb; pdb.set_trace()
            else:
                raise Exception("Missing _status_code in some place!")

        for event in outcoming_event_monitored:
            if event['handler_check'](self.request.uri) and \
                    event['method'] == self.request.method and \
                    event['status_checker'](self._status_code):
                EventTrack(event, self.request.request_time())
                # if event['anomaly_management']:
                #    event['anomaly_management'](self.request)

        if hasattr(self, 'globaleaks_io_debug'):
            try:
                content = ("<" * 15)
                content += (" Response %d " % self.globaleaks_io_debug)
                content += ("<" * 15) + "\n\n"
                content += "status code: " + str(self._status_code) + "\n\n"

                content += "headers:\n"
                for k, v in self._headers.iteritems():
                    content += "%s: %s\n" % (k, v)

                if self._write_buffer is not None:
                    content += "\nbody: " + str(self._write_buffer) + "\n"

                self.do_verbose_log(content)
            except Exception as excep:
                log.err("JSON logging fail (flush): %s" % excep.message)
                return

        RequestHandler.flush(self, include_footers)
開發者ID:tonegas,項目名稱:GlobaLeaks,代碼行數:51,代碼來源:base.py


注:本文中的cyclone.web.RequestHandler.flush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。