def request(host, port, url, method="get", *args, **kwargs):
    try:
        baseUrl = "http://%s:%d" % (host, port)
        url = '/'.join([baseUrl, url])

        if method == "get":
            r = requests.get(url, *args, **kwargs)
        elif method == "post":
            r = requests.post(url, *args, **kwargs)
        elif method == "put":
            r = requests.put(url, *args, **kwargs)
        elif method == "delete":
            r = requests.delete(url, *args, **kwargs)
        else:
            msg = "Unkown HTTP method called: %s" % method
            logging.error(msg)
            raise RequestError(msg)

        if r.status_code in [requests.codes.ok,
                             requests.codes.created,
                             requests.codes.accepted]:
            #
            # Request returned successfully
            #
            try:
                result = r.json()
            except ValueError:
                result = r.text
            return result

        elif r.status_code in [requests.codes.bad,
                               requests.codes.unauthorized,
                               requests.codes.forbidden,
                               requests.codes.not_found,
                               requests.codes.not_allowed,
                               requests.codes.not_acceptable,
                               requests.codes.internal_server_error,
                               requests.codes.not_implemented,
                               requests.codes.unavailable,
                               requests.codes.conflict]:
            try:
                msg = r.text
            except:
                msg = ""

            errMsg = "Error return code: %s, response message: '%s'" % (r.status_code, msg)
            logging.error(errMsg)
            raise RequestError(errMsg)
        else:
            raise RequestError

    except requests.exceptions.Timeout as e:
        errMsg = "Timeout: %s" % e
        logging.error(errMsg)
        raise RequestTimeoutError(errMsg)

    except requests.exceptions.ConnectionError as e:
        errMsg = "Network problem occured: the host you're trying to reach is probably down (%s)" % baseUrl
        logging.error(errMsg)
        raise RequestError(errMsg)

    except requests.exceptions.RequestException as e:
        errMsg = "Unhandled request exception: %s" % e
        logging.error(errMsg)
        raise RequestError(errMsg)

    except RequestError as e:
        raise e

    except Exception as e:
        errMsg = "Unhandled exception: %s" % e
        logging.error(errMsg)
        raise e
Apply the forward pass transformation to the input data.
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/puliclient/server/server.py/request--crossover with--dataset/ETHPy150Open NervanaSystems/neon/neon/layers/layer.py/Layer.fprop