def append_data_to_sent_list(self,
                                 rendered_data,
                                 parser,
                                 response,
                                 producer_timing_delay=0,
                                 max_async_wait_time=0):
        """ Appends rendered data to the sent-request-data list.

        @param rendered_data: A request's rendered data. This is a data string whose
                              dependencies are resolved and is ready to be sent to the
                              server
        @type  rendered_data: Str
        @param parser: The parser for responses of this request
        @type  parser: Func
        @param response: The response that the request received from the server
        @type  response: Str

        @return: None
        @rtype : None

        """
        rendered_data = request_utilities.replace_auth_token(
            rendered_data, f'{AUTHORIZATION_TOKEN_PLACEHOLDER}')
        self._sent_request_data_list.append(
            SentRequestData(rendered_data, parser, response.to_str,
                            producer_timing_delay, max_async_wait_time))
Exemple #2
0
def remove_tokens_from_logs(data):
    """ If the no-tokens-in-logs setting is set, this function will attempt to
    find the token in the data string and replace it with _OMITTED_AUTH_TOKEN_
    @type  data: Str

    @return: The data with the token removed
    @rtype : Str

    """
    global SETTINGS_NO_TOKENS_IN_LOGS
    from engine.core.request_utilities import replace_auth_token
    if SETTINGS_NO_TOKENS_IN_LOGS:
        data = replace_auth_token(data, '_OMITTED_AUTH_TOKEN_')
    return data