def prepare_request(node):
if node.resource.method not in AVAILABLE_METHODS:<EOL><INDENT>raise UnsupportedHTTPMethodError(node.resource.method)<EOL><DEDENT>def request(data=None, json=None, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>for key, value in kwargs.items():<EOL><INDENT>param = next((p for p in node.resource.query_params if p.name == key), None)<EOL>if not param:<EOL><INDENT>raise UnsupportedQueryParameter(node.resource.path, key)<EOL><DEDENT>if not match_type(value, param.type):<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>".format(<EOL>value.__class__.__name__, param.type))<EOL><DEDENT><DEDENT>response = requests.request(node.resource.method, node.resource.absolute_uri, params=kwargs,<EOL>data=data, json=json)<EOL>return response<EOL><DEDENT>return request<EOL>
Prepare request to node's API route

:param Node node: the RAML node object