Encode request into client_message
170392
def encode_request(name, start_sequence, min_count, max_count, filter):
    
    client_message = ClientMessage(payload_size=calculate_size(name, start_sequence, min_count, max_count, filter))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_str(name)
    client_message.append_long(start_sequence)
    client_message.append_int(min_count)
    client_message.append_int(max_count)
    client_message.append_bool(filter is None)
    if filter is not None:
        client_message.append_data(filter)
    client_message.update_frame_length()
    return client_message
1199128
def encode(self, delimiter=';'):
        """"""
        try:
            return delimiter.join([str(f) for f in [
                self.node_id,
                self.child_id,
                int(self.type),
                self.ack,
                int(self.sub_type),
                self.payload,
            ]]) + '\n'
        except ValueError:
            _LOGGER.error('Error encoding message to gateway')
840182
def encode_request(name, value_list):
    
    client_message = ClientMessage(payload_size=calculate_size(name, value_list))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_str(name)
    client_message.append_int(len(value_list))
    for value_list_item in value_list:
        client_message.append_data(value_list_item)
    client_message.update_frame_length()
    return client_message
170893
def encode_request(name, entries):
    
    client_message = ClientMessage(payload_size=calculate_size(name, entries))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_str(name)
    client_message.append_int(len(entries))
    for key, value in six.iteritems(entries):
        client_message.append_data(key)
        client_message.append_data(value)
    client_message.update_frame_length()
    return client_message
1248415
def decode_response(client_message, to_object=None):
    
    parameters = dict(response=None)
    parameters['response'] = client_message.read_int()
    return parameters
777672
def _encode_message_header(cls, client_id, correlation_id, request_key,
                               version=0):
        
        return struct.pack('>hhih%ds' % len(client_id),
                           request_key,          # ApiKey
                           version,              # ApiVersion
                           correlation_id,       # CorrelationId
                           len(client_id),       # ClientId size
                           client_id)
717973
def _get_request_messages(self, request):
        
        data = request.get_data(as_text=True)
        try:
            msg = self.json_decoder.decode(data)
        except Exception:
            raise ParseError("Could not parse request data '{}'".format(data))
        if isinstance(msg, list):
            return msg
        else:
            return [msg]
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
895394
def encode(self, envelope, session, **kwargs):
		
		return WMessengerBytesEnvelope(b64encode(envelope.message()), meta=envelope)
6597
def encode_request(timeout, durability, transaction_type, thread_id):
    
    client_message = ClientMessage(payload_size=calculate_size(timeout, durability, transaction_type, thread_id))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_long(timeout)
    client_message.append_int(durability)
    client_message.append_int(transaction_type)
    client_message.append_long(thread_id)
    client_message.update_frame_length()
    return client_message
367821
def build_request(headers: Headers) -> str:
    
    raw_key = bytes(random.getrandbits(8) for _ in range(16))
    key = base64.b64encode(raw_key).decode()
    headers["Upgrade"] = "websocket"
    headers["Connection"] = "Upgrade"
    headers["Sec-WebSocket-Key"] = key
    headers["Sec-WebSocket-Version"] = "13"
    return key
640731
def request(self, *args, **kwargs):
        
        r = self.session.request(*args, **kwargs)
        if r.status_code != requests.codes.ok:
            error = ET.fromstring(r.content)
            message = error.findtext('message')
            code = error.attrib['key']
            raise CleanwebError('%s (%s)' % (message, code))
        return r
722022
def encode(msg):
    
    msg = bytes(msg)
    return END + msg.replace(ESC, ESC + ESC_ESC).replace(END, ESC + ESC_END) + END
262874
def encode(self, envelope, session, **kwargs):
		
		return WMessengerTextEnvelope(str(WHex(envelope.message())), meta=envelope)
1108323
def encode_params(params, **kwargs):
    """"""
    cleaned = clean_params(params, **kwargs)
    return json.dumps(cleaned)
1037422
def encode_base64(msg):
    
    orig = msg.get_payload()
    encdata = str(_bencode(orig), 'ascii')
    msg.set_payload(encdata)
    msg['Content-Transfer-Encoding'] = 'base64'
983696
def encode_request(uuid, partition_id, interrupt):
    
    client_message = ClientMessage(payload_size=calculate_size(uuid, partition_id, interrupt))
    client_message.set_message_type(REQUEST_TYPE)
    client_message.set_retryable(RETRYABLE)
    client_message.append_str(uuid)
    client_message.append_int(partition_id)
    client_message.append_bool(interrupt)
    client_message.update_frame_length()
    return client_message