'Utility function to perform an API call with retries
:param endpoint_info: Tuple of method and endpoint
:type endpoint_info: (string, string)
:param json: Parameters for this API call.
:type json: dict
:return: If the api call returns a OK status code,
this function returns the response in JSON. Otherwise,
we throw an AirflowException.
:rtype: dict'

def _do_api_call(self, endpoint_info, json):

    (method, endpoint) = endpoint_info
    url = 'https://{host}/{endpoint}'.format(host=self._parse_host(self.databricks_conn.host), endpoint=endpoint)
    auth = (self.databricks_conn.login, self.databricks_conn.password)
    if (method == 'GET'):
        request_func = requests.get
    elif (method == 'POST'):
        request_func = requests.post
    else:
        raise AirflowException(('Unexpected    HTTP    Method:    ' + method))
    for attempt_num in range(1, (self.retry_limit + 1)):
        try:
            response = request_func(url, json=json, auth=auth, headers=USER_AGENT_HEADER, timeout=self.timeout_seconds)
            if (response.status_code == requests.codes.ok):
                return response.json()
            else:
                raise AirflowException('Response:    {0},    Status    Code:    {1}'.format(response.content, response.status_code))
        except (requests_exceptions.ConnectionError, requests_exceptions.Timeout) as e:
            logging.error(('Attempt    {0}    API    Request    to    Databricks    failed    ' + 'with    reason:    {1}').format(attempt_num, e))
    raise AirflowException(('API    requests    to    Databricks    failed    {}    times.    ' + 'Giving    up.').format(self.retry_limit))
