def do_POST(self, request, response): """ Handle a POST request :param request: The HTTP request bean :param request: The HTTP response handler """ # Get the request JSON content data = jsonrpclib.loads(to_str(request.read_data())) # Convert from Jabsorb data = jabsorb.from_jabsorb(data) # Dispatch try: result = self._unmarshaled_dispatch(data, self._simple_dispatch) except NoMulticallResult: # No result (never happens, but who knows...) result = None if result is not None: # Convert result to Jabsorb if 'result' in result: result['result'] = jabsorb.to_jabsorb(result['result']) # Store JSON result = jsonrpclib.jdumps(result) else: # It was a notification result = '' # Send the result response.send_content(200, result, 'application/json-rpc')
def do_POST(self, request, response): """ Handle a POST request :param request: The HTTP request bean :param request: The HTTP response handler """ # Get the request JSON content data = jsonrpclib.loads(to_str(request.read_data())) # Convert from Jabsorb data = jabsorb.from_jabsorb(data) # Dispatch try: result = self._unmarshaled_dispatch(data, self._simple_dispatch) except NoMulticallResult: # No result (never happens, but who knows...) result = None if result is not None: # Convert result to Jabsorb if 'result' in result: result['result'] = jabsorb.to_jabsorb(result['result']) # Store JSON result = jsonrpclib.jdumps(result) else: # It was a notification result = '' # Send the result response.send_content(200, result, 'application/json-rpc')