# Path: src/tests/behave/api/features/common/exception.py
# class TimeoutException(BaseBehaveException):
#     message = "Request timed out"


import time
import json
import requests
from src.tests.behave.api.features.common.exception import TimeoutException




def check_service_api(url, interval_time=5, timeout=20):
    """Check for running service API

    :type url: str
    :type interval_time: int
    :type timeout: int

    """
    end_time = time.time() + timeout

    while time.time() < end_time:
        try:
            resp = requests.get(url)
        except requests.exceptions.RequestException:
            time.sleep(interval_time)
            continue
        if resp.status_code:
            break
    else:

# Path: src/tests/behave/api/features/common/exception.py
# class TimeoutException(BaseBehaveException):
#     message = "Request timed out"


# Path: src/tests/behave/api/features/common/utils.py
import time
import json
import requests
from src.tests.behave.api.features.common.exception import TimeoutException





def check_service_api(url, interval_time=5, timeout=20):
    """Check for running service API

    :type url: str
    :type interval_time: int
    :type timeout: int

    """
    end_time = time.time() + timeout

    while time.time() < end_time:
        try:
            resp = requests.get(url)
        except requests.exceptions.RequestException:
            time.sleep(interval_time)
            continue
        if resp.status_code:
            break
    else:

        raise TimeoutException(