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


Python Report.debug方法代码示例

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


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

示例1: do_GET

# 需要导入模块: from kol.util import Report [as 别名]
# 或者: from kol.util.Report import debug [as 别名]
    def do_GET(self):
        if not self.path.count('/newchatmessages.php?') and not self.path.count('/submitnewchat.php?'):
            Report.debug("relay", "GET: %s" % self.path)

        relayServer = self.server.relayServer

        # Check to see if we should terminate the RelayServer.
        if self.path == '/terminate':
            relayServer.haltEvent.set()
            self.wfile.write('Server Stopping...')
            return

        # Redirect empty URL to main.html.
        if self.path == '/':
            self.path = '/main.html'

        # Execute the server request.
        dReq = DynamicRequest(relayServer.session, self.path[1:])
        dReq.doRequest()

        # The following line is for the sake of some js scripts (mainly chat).
        page = dReq.responseText.replace("window.location.hostname", 'window.location.hostname+":"+window.location.port')

        # Add server shutdown in compact mode.
        if self.path == '/topmenu.php':
            page = page.replace('<option value="logout.php">Log Out</option>','<option value="terminate">Stop Server</option>')

        self.wfile.write(page)
开发者ID:Alecat,项目名称:pykol,代码行数:30,代码来源:RelayRequestHandler.py

示例2: doRequest

# 需要导入模块: from kol.util import Report [as 别名]
# 或者: from kol.util.Report import debug [as 别名]
    def doRequest(self):
        """
		Performs the request. This method will ensure that nightly maintenance is not occuring.
		In addition, this method will throw a NotLoggedInError if the session thinks it is logged
		in when it actually isn't. All specific KoL requests should inherit from this class.
		"""

        Report.debug("request", "Requesting %s" % self.url)

        self.response = self.session.opener.open(self.url, urllib.urlencode(self.requestData))
        self.responseText = self.response.read()

        Report.debug("request", "Received response: %s" % self.url)
        Report.debug("request", "Response Text: %s" % self.responseText)

        if self.response.geturl().find("/maint.php") >= 0:
            self.session.isConnected = False
            raise NightlyMaintenanceError("Nightly maintenance in progress.")

        if self.response.geturl().find("/login.php") >= 0:
            if self.session.isConnected:
                self.session.isConnected = False
                raise NotLoggedInError("You are no longer connected to the server.")

                # Allow for classes that extend GenericRequest to parse all of the data someone
                # would need from the response and then to place this data in self.responseData.
        self.responseData = {}
        if self.skipParseResponse == False and "parseResponse" in self.__class__.__dict__:
            self.parseResponse()
            if len(self.responseData) > 0:
                Report.debug("request", "Parsed response data: %s" % self.responseData)

        return self.responseData
开发者ID:ZJ,项目名称:pykol,代码行数:35,代码来源:GenericRequest.py

示例3: doRequest

# 需要导入模块: from kol.util import Report [as 别名]
# 或者: from kol.util.Report import debug [as 别名]
    def doRequest(self):
        """
        Performs the request. This method will ensure that nightly maintenance is not occuring.
        In addition, this method will throw a NOT_LOGGED_IN error if the session thinks it is
        logged in when it actually isn't. All specific KoL requests should inherit from this class.
        """

        Report.debug("request", "Requesting %s" % self.url)

        self.response = self.session.opener.open(self.url, self.requestData)
        self.responseText = self.response.text

        Report.debug("request", "Received response: %s" % self.url)
        Report.debug("request", "Response Text: %s" % self.responseText)

        if self.response.url.find("/maint.php") >= 0:
            self.session.isConnected = False
            raise Error.Error("Nightly maintenance in progress.", Error.NIGHTLY_MAINTENANCE)

        if self.response.url.find("/login.php") >= 0:
            if self.session.isConnected:
                self.session.isConnected = False
                raise Error.Error("You are no longer connected to the server.", Error.NOT_LOGGED_IN)

        # Allow for classes that extend GenericRequest to parse all of the data someone
        # would need from the response and then to place this data in self.responseData.
        self.responseData = {}
        if self.skipParseResponse == False and hasattr(self, "parseResponse"):
            self.parseResponse()
            if len(self.responseData) > 0:
                Report.debug("request", "Parsed response data: %s" % self.responseData)

        return self.responseData
开发者ID:Cairnarvon,项目名称:pykol,代码行数:35,代码来源:GenericRequest.py

示例4: do_POST

# 需要导入模块: from kol.util import Report [as 别名]
# 或者: from kol.util.Report import debug [as 别名]
    def do_POST(self):
        Report.debug("relay", "POST: %s" % self.path)

        relayServer = self.server.relayServer

        # Parse out the POST parameters.
        headers = str(self.headers).split('\n')
        length = 0
        for x in headers:
            if x.split(':')[0].lower() == 'content-length':
                length = int(x.split(':')[1].strip())
        payload =  self.rfile.read(length)

        # Execute the server request.
        dReq = DynamicRequest(relayServer.session, self.path[1:], payload)
        dReq.doRequest()
        self.wfile.write(dReq.responseText)
开发者ID:Alecat,项目名称:pykol,代码行数:19,代码来源:RelayRequestHandler.py

示例5: doRequest

# 需要导入模块: from kol.util import Report [as 别名]
# 或者: from kol.util.Report import debug [as 别名]
    def doRequest(self):
        """
        Performs the request. This method will ensure that nightly maintenance is not occuring.
        In addition, this method will throw a NOT_LOGGED_IN error if the session thinks it is
        logged in when it actually isn't.
        """

        Report.debug("request", "Requesting %s" % self.url)

        self.response = self.session.opener.opener.post(self.url, self.requestData, stream=True)
        responseStr = StringIO()
        try:
            for chunk in self.response.iter_content(self.chunkSize):
                responseStr.write(chunk)
                s = responseStr.getvalue()
                
                matched = True
                for regex in self.regexList:
                    if not regex.search(s):
                        matched = False
                        break

                if matched:                    
                    break

            self.responseText = responseStr.getvalue()
            responseStr.close()
        finally:
            self.response.close()

        Report.debug("request", "Received response: %s" % self.url)
        Report.debug("request", "Response Text: %s" % self.responseText)

        if self.response.url.find("/maint.php") >= 0:
            self.session.isConnected = False
            raise Error.Error("Nightly maintenance in progress.", Error.NIGHTLY_MAINTENANCE)

        if self.response.url.find("/login.php") >= 0:
            if self.session.isConnected:
                self.session.isConnected = False
                raise Error.Error("You are no longer connected to the server.", Error.NOT_LOGGED_IN)

        # Allow for classes that extend GenericRequest to parse all of the data someone
        # would need from the response and then to place this data in self.responseData.
        self.responseData = {}
        if self.skipParseResponse == False and hasattr(self, "parseResponse"):
            self.parseResponse()
            if len(self.responseData) > 0:
                Report.debug("request", "Parsed response data: %s" % self.responseData)

        return self.responseData
开发者ID:ijzer,项目名称:cwbot-ndy,代码行数:53,代码来源:GenericPartialRequest.py


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