Build response ADU from meta data and response PDU and return it.

        :param meta_data: A dict with meta data.
        :param request_pdu: A bytearray containing request PDU.
        :return: A bytearray containing request ADU.
426631
def create_response_adu(self, meta_data, response_pdu):
        
        response_mbap = pack_mbap(
            transaction_id=meta_data['transaction_id'],
            protocol_id=meta_data['protocol_id'],
            length=len(response_pdu) + 1,
            unit_id=meta_data['unit_id']
        )

        return response_mbap + response_pdu
627110
def options(self, request, *args, **kwargs):
        
        if self.metadata_class is None:
            return self.http_method_not_allowed(request, *args, **kwargs)
        data = self.metadata_class().determine_metadata(request, self)
        return Response(data, status=status.HTTP_200_OK)
1141086
def _process_meta(self, response):
        """"""
        for key in self.META_ENVELOPES:
            self.meta[key] = response.get(key)
873717
def get_survey_meta
      url = ApiRequest.base_path("questionpro.survey.sendSurveyMetaData")
      result = self.class.get(url, body: self.options)

      self.full_response = result
      self.status = result['status']
      
      survey_meta = SurveyMeta.new(result['response'])
      
      return survey_meta          
    end
621977
def encode_consumermetadata_request(cls, client_id, correlation_id,
                                        consumer_group):
        
        message = cls._encode_message_header(client_id, correlation_id,
                                             KafkaCodec.CONSUMER_METADATA_KEY)
        message += write_short_ascii(consumer_group)
        return message
332077
function putMeta(uri, data) {
  const id = replaceVersion(uri.replace('/meta', ''));

  return db.putMeta(id, data)
    .then(pubToBus(id));
}
456413
def metadata_response(self, request, full_url, headers):
        

        parsed_url = urlparse(full_url)
        tomorrow = datetime.datetime.utcnow() + datetime.timedelta(days=1)
        credentials = dict(
            AccessKeyId="test-key",
            SecretAccessKey="test-secret-key",
            Token="test-session-token",
            Expiration=tomorrow.strftime("%Y-%m-%dT%H:%M:%SZ")
        )

        path = parsed_url.path

        meta_data_prefix = "/latest/meta-data/"
        # Strip prefix if it is there
        if path.startswith(meta_data_prefix):
            path = path[len(meta_data_prefix):]

        if path == '':
            result = 'iam'
        elif path == 'iam':
            result = json.dumps({
                'security-credentials': {
                    'default-role': credentials
                }
            })
        elif path == 'iam/security-credentials/':
            result = 'default-role'
        elif path == 'iam/security-credentials/default-role':
            result = json.dumps(credentials)
        else:
            raise NotImplementedError(
                "The {0} metadata path has not been implemented".format(path))
        return 200, headers, result
236340
def transport_meta_data(self):
        """"""

        # For each packet in the pcap process the contents
        for item in self.input_stream:

            # Get the transport data and type
            trans_data = item['packet']['data']
            trans_type = self._get_transport_type(trans_data)
            if trans_type and trans_data:
                item['transport'] = data_utils.make_dict(trans_data)
                item['transport']['type'] = trans_type
                item['transport']['flags'] = self._readable_flags(item['transport'])
                item['transport']['data'] = trans_data['data']

            # All done
            yield item
1374238
def getMetadataId(self, metadata):
        
        return str(datamodel.VariantSetMetadataCompoundId(
            self.getCompoundId(), 'metadata:' + metadata.key))
341723
def parse_request(self, request, parameters, fake_method=None):
        '''
        
        '''
        return (fake_method or request.method,
                request.build_absolute_uri(),
                request.META,
                (dict(request.POST.iteritems())
                    if request.method == 'POST'
                    else parameters))
855447
def parse_response_adu(resp_adu, req_adu=None):
    
    resp_pdu = resp_adu[1:-2]
    validate_crc(resp_adu)

    req_pdu = None

    if req_adu is not None:
        req_pdu = req_adu[1:-2]

    function = create_function_from_response_pdu(resp_pdu, req_pdu)

    return function.data
1343230
def encode_consumer_metadata_request(cls, client_id, correlation_id, payloads):
        
        message = []
        message.append(cls._encode_message_header(client_id, correlation_id,
                                                  KafkaProtocol.CONSUMER_METADATA_KEY))
        message.append(struct.pack('>h%ds' % len(payloads), len(payloads), payloads))

        msg = b''.join(message)
        return write_int_string(msg)
1233763
def _request(self, url, params=None):
        

        response = get(url, params=params, headers=self.headers, timeout=30)

        if response.status_code != 200:
            raise APIError('Request to {} returned {}'.format(response.url, response.status_code))

        response = response.json()

        error_text = response['service_meta']['error_text']
        if error_text:
            raise APIError(error_text)

        return response
253746
def get_meta_data(self, request_adu):
        "
        try:
            transaction_id, protocol_id, length, unit_id = \
                unpack_mbap(request_adu[:7])
        except struct.error:
            raise ServerDeviceFailureError()

        return {
            'transaction_id': transaction_id,
            'protocol_id': protocol_id,
            'length': length,
            'unit_id': unit_id,
        }
1149855
def request_metadata
      {
        uuid: request.uuid,
        url: request.original_url,
        headers: request.env.select { |key, _v| key =~ /^HTTP_/ },
        ip: request.remote_ip
      }
    end
790531
def send_meta_data(socket, conf, name):
    '''
    '''
    meta_data = dict(
        name=name,
        conf=conf
    )
    try:
        socket.send_json(meta_data, flags=zmq.NOBLOCK)
    except zmq.Again:
        pass
899028
def _get_metadata(cls, request, response, head=None):
        
        head = response.get('head_id', head)
        metadata = {'link': cls._build_url(request, head=head)}

        if head is not None:
            metadata['head'] = head
        return metadata