

def gather_parameters(self, request, response, api_version=None, **input_parameters):
    'Gathers and returns all parameters that will be used for this endpoint'
    input_parameters.update(request.params)
    if (self.parse_body and (request.content_length is not None)):
        body = request.stream
        (content_type, encoding) = separate_encoding(request.content_type)
        body_formatter = (body and self.api.http.input_format(content_type))
        if body_formatter:
            body = (body_formatter(body, encoding) if (encoding is not None) else body_formatter(body))
        if ('body' in self.parameters):
            input_parameters['body'] = body
        if isinstance(body, dict):
            input_parameters.update(body)
    elif ('body' in self.parameters):
        input_parameters['body'] = None
    if ('request' in self.parameters):
        input_parameters['request'] = request
    if ('response' in self.parameters):
        input_parameters['response'] = response
    if ('api_version' in self.parameters):
        input_parameters['api_version'] = api_version
    for (parameter, directive) in self.directives.items():
        arguments = ((self.defaults[parameter],) if (parameter in self.defaults) else ())
        input_parameters[parameter] = directive(*arguments, response=response, request=request, api=self.api, api_version=api_version, interface=self)
    return input_parameters

dataset/ETHPy150Open timothycrosley/hug/hug/interface.py HTTP.gather_parameters/original