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


Python SimpleJSONRPCServer.SimpleJSONRPCRequestHandler类代码示例

本文整理汇总了Python中jsonrpclib.SimpleJSONRPCServer.SimpleJSONRPCRequestHandler的典型用法代码示例。如果您正苦于以下问题:Python SimpleJSONRPCRequestHandler类的具体用法?Python SimpleJSONRPCRequestHandler怎么用?Python SimpleJSONRPCRequestHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: do_POST

 def do_POST(self):
     # pylint: disable=E1101
     if self.path == '/RPC2':
         SimpleJSONRPCRequestHandler.do_POST(self)
     else:
         __pychecker__ = 'no-classattr'
         SimpleHTTPRequestHandler.do_POST(self)
开发者ID:christophgysin,项目名称:schoolbell,代码行数:7,代码来源:requesthandler.py

示例2: do_POST

    def do_POST(self):

        if self.auth_map != None:
            if self.headers.has_key('authorization') and self.headers['authorization'].startswith('Basic '):
                authenticationString = base64.b64decode(self.headers['authorization'].split(' ')[1])
                if authenticationString.find(':') != -1:
                    username, password = authenticationString.split(':', 1)
                    self.logger.info('Got request from %s:%s' % (username, password))

                    if self.auth_map.has_key(username) and self.verifyPassword(username, password):
                        return SimpleJSONRPCRequestHandler.do_POST(self)
                    else:
                        self.logger.error('Authentication failed for %s:%s' % (username, password))
            
            self.logger.error('Authentication failed')
            self.send_response(401)
            self.end_headers()
            return False

        return SimpleJSONRPCRequestHandler.do_POST(self)
开发者ID:agupta13,项目名称:google-cache,代码行数:20,代码来源:traceroute_service.py

示例3: parse_request

 def parse_request(myself):
     # first, call the original implementation which returns
     # True if all OK so far
     if SimpleJSONRPCRequestHandler.parse_request(myself):
         try:
             self.authenticate(myself.headers)
             return True
         except (RPCAuthCredentialsInvalid, RPCAuthCredentialsMissing,
                 RPCAuthUnsupportedType) as e:
             myself.send_error(401, str(e))
         except BaseException as e:
             import traceback, sys
             traceback.print_exc(file=sys.stderr)
             myself.send_error(500, str(e))
     return False
开发者ID:bauerj,项目名称:electrum,代码行数:15,代码来源:jsonrpc.py

示例4: parse_request

 def parse_request(myself):
     # first, call the original implementation which returns
     # True if all OK so far
     if SimpleJSONRPCRequestHandler.parse_request(myself):
         # Do not authenticate OPTIONS-requests
         if myself.command.strip() == 'OPTIONS':
             return True
         try:
             self.authenticate(myself.headers)
             return True
         except (RPCAuthCredentialsInvalid, RPCAuthCredentialsMissing,
                 RPCAuthUnsupportedType) as e:
             myself.send_error(401, str(e))
         except BaseException as e:
             self.logger.exception('')
             myself.send_error(500, str(e))
     return False
开发者ID:vialectrum,项目名称:vialectrum,代码行数:17,代码来源:jsonrpc.py

示例5: end_headers

 def end_headers(self):
     self.send_header("Access-Control-Allow-Headers",
                      "Origin, X-Requested-With, Content-Type, Accept")
     self.send_header("Access-Control-Allow-Origin", "*")
     SimpleJSONRPCRequestHandler.end_headers(self)
开发者ID:Firescar96,项目名称:eth-testrpc,代码行数:5,代码来源:__main__.py

示例6: end_headers

 def end_headers(self):
     self.send_header("Access-Control-Allow-Origin", "*")
     SimpleJSONRPCRequestHandler.end_headers(self)
开发者ID:AlexandreQuintela,项目名称:zebra,代码行数:3,代码来源:startup.py

示例7: __init__

 def __init__(self, request, client_address, server, client_digest=None):
     self.logger = logging.getLogger(__name__)
     self.auth_map = server.auth_map
     SimpleJSONRPCRequestHandler.__init__(self, request, client_address, server)
     self.client_digest = client_digest
开发者ID:agupta13,项目名称:google-cache,代码行数:5,代码来源:traceroute_service.py

示例8: do_POST

	def do_POST(self):
		if self.client_address[0] not in allowed_ips:
			self.send_error(403,"Your address is not in allowed_ips")
			return
		SimpleJSONRPCRequestHandler.do_POST(self)
开发者ID:dingensundso,项目名称:myMplayer,代码行数:5,代码来源:server.py

示例9: setup

        def setup(self):
                """Prepare to handle a request."""

                rv = SimpleRPCRequestHandler.setup(self)

                # StreamRequestHandler will have duped our PipeSocket via
                # makefile(), so close the connection socket here.
                self.connection.close()
                return rv
开发者ID:aszeszo,项目名称:test,代码行数:9,代码来源:pipeutils.py

示例10: finish

 def finish(self):
     for sig in _MASKED_SIGS:
         signal.signal(sig, _SIG_HANDLERS[sig])
     if _deferred_sig:
         os.kill(os.getpid(), _deferred_sig)
     return handler.finish(self)
开发者ID:yilab,项目名称:fsq,代码行数:6,代码来源:jsonrpcd.py

示例11: handle

 def handle(self):
     return handler.handle(self)
开发者ID:yilab,项目名称:fsq,代码行数:2,代码来源:jsonrpcd.py

示例12: setup

 def setup(self):
     for sig in _MASKED_SIGS:
         signal.signal(sig, _defer_sig)
     return handler.setup(self)
开发者ID:yilab,项目名称:fsq,代码行数:4,代码来源:jsonrpcd.py


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