def inject_data_from_environ(request_id, environ): request_in_store = request_store.get(request_id, None) if request_in_store is None: raise Exception() request_data = request_in_store.get('data', None) if request_data is None: request_in_store['data'] = {} request_data = request_in_store['data'] request_data.update(_request_tab_data(environ))
def handle(self, request, request_id=None): response_data = request_store.get(request_id, None) if response_data is None: request.response_status = '404 Not Found' content_type = 'text/plain' response_data = 'No Resource Exists with that ID' else: content_type = 'application/json' response_with_id = response_data.copy() response_with_id['requestId'] = request_id response_data = json.dumps(response_with_id) request.response_headers['content-type'] = content_type return response_data