本文整理汇总了Python中SimpleXMLRPCServer.SimpleXMLRPCRequestHandler.decode_request_content方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleXMLRPCRequestHandler.decode_request_content方法的具体用法?Python SimpleXMLRPCRequestHandler.decode_request_content怎么用?Python SimpleXMLRPCRequestHandler.decode_request_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXMLRPCServer.SimpleXMLRPCRequestHandler
的用法示例。
在下文中一共展示了SimpleXMLRPCRequestHandler.decode_request_content方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: decode_request_content
# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler import decode_request_content [as 别名]
def decode_request_content(self, data):
data = SimpleXMLRPCRequestHandler.decode_request_content(self, data)
doc = parseString(data)
ps = doc.getElementsByTagName("params")[0]
pdoc = parseString(
""" <param><value>
<string>%s</string>
</value></param>"""
% (self.client_ip,)
)
p = pdoc.firstChild.cloneNode(True)
ps.insertBefore(p, ps.firstChild)
return doc.toxml()
示例2: decode_request_content
# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler import decode_request_content [as 别名]
def decode_request_content(self, data):
'''
Overrides in order to capture Authorization header.
'''
token = None
if 'Authorization' in self.headers:
value = self.headers.get("Authorization", "")
token = value[8:] if value.startswith("Bearer: ") else ""
if self.server.auth_handler.validate_token(token):
return SimpleXMLRPCRequestHandler.decode_request_content(self, data)
else:
self.send_response(401, "Could not authenticate with OAuth")
self.send_header("WWW-Authenticate", "realm=\"https://www.codalab.org\"")
self.send_header("Content-length", "0")
self.end_headers()
示例3: decode_request_content
# 需要导入模块: from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler [as 别名]
# 或者: from SimpleXMLRPCServer.SimpleXMLRPCRequestHandler import decode_request_content [as 别名]
def decode_request_content(self, data):
encoding = self.headers.get("content-encoding", "identity").lower()
if encoding != "gzip":
self.send_response(501, "encoding %r not supported" % encoding)
return SimpleXMLRPCRequestHandler.decode_request_content(self, data)