當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。