本文整理汇总了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)
示例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
示例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
示例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)
示例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