def retryRequest(url, headers, jsonData=None, retryCount=3):
    """
    Function to post messages and retry on failure
    :param url: url to post messages to
    :param headers: headers to add to the post call 
    :param jsonData: payload for the post call
    :param retryCount: number of retries on failure, default value is set to 3
    :return: response if successful, None otherwise
    """
    while retryCount > 0:
        try:
            response = requests.post(url, headers=headers, json=jsonData, timeout=5)
        except Exception as err:
            logging.error(f"Error during the request: {err}")
            retryCount -= 1
        else:
            if response.status_code == HTTPStatus.OK:
                logging.info("Post request successful")
                return response
            elif response.status_code == HTTPStatus.UNAUTHORIZED:
                logging.error("Authorization Error while calling post request")
                return response
            else:
                logging.error(f"Post request failed, retrying... status code: {response.status_code}")
                retryCount -= 1     
    return None

    Function to post messages and retry on failure
    :param url: url to post messages to
    :param headers: headers to add to the post call 
    :param jsonData: payload for the post call
    :param retryCount: number of retries on failure, default value is set to 3
    :return: response if successful, None otherwise
    
Solutions/Cisco ETD/Data Connectors/CiscoETDAzureSentinelConnector/__init__.py