def _send_request(self, session: 'requests.Session', method: str, url: str, params: Dict[(str, JSONLike)]=None, headers: dict=None) -> 'requests.models.Response':
    if (prefect.context.config.cloud.get('diagnostics') is True):
        self.logger.debug(f'Preparing request to {url}')
        clean_headers = {head: re.sub('Bearer .*', 'Bearer XXXX', val) for (head, val) in headers.items()}
        self.logger.debug(f'Headers: {clean_headers}')
        self.logger.debug(f'Request: {params}')
        start_time = time.time()
    if (method == 'GET'):
        response = session.get(url, headers=headers, params=params, timeout=30)
    elif (method == 'POST'):
        response = session.post(url, headers=headers, json=params, timeout=30)
    elif (method == 'DELETE'):
        response = session.delete(url, headers=headers, timeout=30)
    else:
        raise ValueError('Invalid method: {}'.format(method))
    if (prefect.context.config.cloud.get('diagnostics') is True):
        end_time = time.time()
        self.logger.debug(f'Response: {response.json()}')
        self.logger.debug(f'Request duration: {round((end_time - start_time), 4)} seconds')
    response.raise_for_status()
    return response
def _send_request(self, session: 'requests.Session', method: str, url: str, params: Dict[(str, JSONLike)]=None, headers: dict=None) -> 'requests.models.Response':
    if (prefect.context.config.cloud.get('diagnostics') is True):
        self.logger.debug(f'Preparing request to {url}')
        clean_headers = {head: re.sub('Bearer .*', 'Bearer XXXX', val) for (head, val) in headers.items()}
        self.logger.debug(f'Headers: {clean_headers}')
        self.logger.debug(f'Request: {params}')
        start_time = time.time()
    if (method == 'GET'):
        response = session.get(url, headers=headers, params=params, timeout=30)
    elif (method == 'POST'):
        response = session.post(url, headers=headers, json=params, timeout=30)
    elif (method == 'DELETE'):
        response = session.delete(url, headers=headers, timeout=30)
    else:
        raise ValueError('Invalid method: {}'.format(method))
    if (prefect.context.config.cloud.get('diagnostics') is True):
        end_time = time.time()
        self.logger.debug(f'Response: {response.json()}')
        self.logger.debug(f'Request duration: {round((end_time - start_time), 4)} seconds')
    response.raise_for_status()
    return response