# Path: core/constants.py
# SESSION_CLOSE_REASON_API_CALL = "Session closed via API stop_session call"
# GET_ENDPOINT_ATTEMPTS = 10
# ENDPOINT_REBUILD_ATTEMPTS = 3
# CREATE_SESSION_REQUEST_TIMEOUT = 60
# REQUEST_TIMEOUT = 60
# MAKE_REQUEST_ATTEMPTS_AMOUNT = 3
# REQUEST_SLEEP_BASE_TIME = 5
# REQUEST_TIMEOUT_ON_CREATE_ENDPOINT = 60
# ANY = u'ANY'
# GET_SESSION_SLEEP_TIME = 2
# ER_SLEEP_TIME = 2
# EP_SLEEP_TIME = 2
# 
# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):
# 
# Path: core/exceptions.py
# class RequestException(Exception):
#     pass
# 
# class RequestTimeoutException(Exception):
#     pass
# 
# Path: core/utils/system_utils.py
# def run_command(command, silent=False):


import time
import logging
import netifaces
import requests
import socket
from Queue import Queue
from threading import Thread
from core import constants, config
from core.exceptions import RequestException, RequestTimeoutException
from . import system_utils
        del request.headers['Host']

    def get_response():
        try:
            queue.put(
                requests.request(
                    method=request.method,
                    url=url,
                    headers=request.headers,
                    data=request.data,
                    timeout=timeout
                )
            )
        except Exception as e:
            queue.put(e)

    attempts = getattr(config, "MAKE_REQUEST_ATTEMPTS_AMOUNT", constants.MAKE_REQUEST_ATTEMPTS_AMOUNT)
    for attempt in range(1, attempts + 1):
        queue = Queue()
        log.info("Attempt {}. Making request {} with timeout {} sec.".format(attempt, url, timeout))
        t = Thread(target=get_response)
        t.daemon = True
        t.start()

        while t.isAlive():
            yield None, None, None

        response = queue.get()
        if attempt >= attempts:
            if isinstance(response, requests.Timeout):

# Path: core/constants.py
# SESSION_CLOSE_REASON_API_CALL = "Session closed via API stop_session call"
# GET_ENDPOINT_ATTEMPTS = 10
# ENDPOINT_REBUILD_ATTEMPTS = 3
# CREATE_SESSION_REQUEST_TIMEOUT = 60
# REQUEST_TIMEOUT = 60
# MAKE_REQUEST_ATTEMPTS_AMOUNT = 3
# REQUEST_SLEEP_BASE_TIME = 5
# REQUEST_TIMEOUT_ON_CREATE_ENDPOINT = 60
# ANY = u'ANY'
# GET_SESSION_SLEEP_TIME = 2
# ER_SLEEP_TIME = 2
# EP_SLEEP_TIME = 2
# 
# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):
# 
# Path: core/exceptions.py
# class RequestException(Exception):
#     pass
# 
# class RequestTimeoutException(Exception):
#     pass
# 
# Path: core/utils/system_utils.py
# def run_command(command, silent=False):


# Path: core/utils/network_utils.py
import time
import logging
import netifaces
import requests
import socket
from Queue import Queue
from threading import Thread
from core import constants, config
from core.exceptions import RequestException, RequestTimeoutException
from . import system_utils

        del request.headers['Host']

    def get_response():
        try:
            queue.put(
                requests.request(
                    method=request.method,
                    url=url,
                    headers=request.headers,
                    data=request.data,
                    timeout=timeout
                )
            )
        except Exception as e:
            queue.put(e)

    attempts = getattr(config, "MAKE_REQUEST_ATTEMPTS_AMOUNT", constants.MAKE_REQUEST_ATTEMPTS_AMOUNT)
    for attempt in range(1, attempts + 1):
        queue = Queue()
        log.info("Attempt {}. Making request {} with timeout {} sec.".format(attempt, url, timeout))
        t = Thread(target=get_response)
        t.daemon = True
        t.start()

        while t.isAlive():
            yield None, None, None

        response = queue.get()
        if attempt >= attempts:
            if isinstance(response, requests.Timeout):

                raise RequestTimeoutException(