def parse_request(self): # first, call the original implementation which returns # True if all OK so far if SimpleJSONRPCRequestHandler.parse_request(self): try: self.server.authenticate(self.headers) return True except (RPCAuthCredentialsInvalid, RPCAuthCredentialsMissing, RPCAuthUnsupportedType) as e: self.send_error(401, str(e)) except BaseException as e: logging.exception("") self.send_error(500, str(e)) return False
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
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