minermedic/minermedic.py
def api_add_miner(ip_address, model_id):

    """
    Adds a Miner Object via the REST API
    e.g.:  http://localhost:5000/minermedic/api/v1/add_miner/192.168.1.223/17

    Please Note - when adding a Miner from the UI, this endpoint is NOT CALLED.
    Instead, the __add_object_internal API call is called in the core REST API.
    This endpoint is a convenience method for other 3rd party implementations.

    :param ip_address: The IP address of the Miner to add
    :param model_id: The Model ID of the Miner to add
    :return: JSON response including new Miner ID if successful
    """

    from flask.json import jsonify

    success = __add_miner(ip_address, model_id)

    if success:
        status = _API_ERROR_CODES_['OK'].value
        error = _API_ERROR_MESSAGES_['OK'].value
        miner_id = get_object_by_ip(ip_address).id
    else:
        status = _API_ERROR_CODES_['OP_FAILED'].value
        error = _API_ERROR_MESSAGES_['OP_FAILED'].value
        miner_id = -1

    response = {"status": status,
                "error": error,
                "id": miner_id}

    return jsonify(data=[response])

    Adds a Miner Object via the REST API
    e.g.:  http://localhost:5000/minermedic/api/v1/add_miner/192.168.1.223/17

    Please Note - when adding a Miner from the UI, this endpoint is NOT CALLED.
    Instead, the __add_object_internal API call is called in the core REST API.
    This endpoint is a convenience method for other 3rd party implementations.

    :param ip_address: The IP address of the Miner to add
    :param model_id: The Model ID of the Miner to add
    :return: JSON response including new Miner ID if successful
    


Please Note - when adding a Miner from the UI, this endpoint is NOT CALLED.
Instead, the __add_object_internal API call is called in the core REST API.
This endpoint is a convenience method for other 3rd party implementations.
Please Note - when adding a Miner from the UI this endpoint is NOT CALLED . Instead the __add_object_internal API call is called in the core REST API . This endpoint is a convenience method for other 3rd party implementations .
def api_add_miner(ip_address, model_id):
    from flask.json import jsonify
    success = __add_miner(ip_address, model_id)
    if success:
        status = _API_ERROR_CODES_['OK'].value
        error = _API_ERROR_MESSAGES_['OK'].value
        miner_id = get_object_by_ip(ip_address).id
    else:
        status = _API_ERROR_CODES_['OP_FAILED'].value
        error = _API_ERROR_MESSAGES_['OP_FAILED'].value
        miner_id = -1
    response = {"status": status,
                "error": error,
                "id": miner_id}
    return jsonify(data=[response])
def api_add_miner ( ip_address , model_id ) : from flask . json import jsonify success = __add_miner ( ip_address , model_id ) if success : status = _API_ERROR_CODES_ [ 'OK' ] . value error = _API_ERROR_MESSAGES_ [ 'OK' ] . value miner_id = get_object_by_ip ( ip_address ) . id else : status = _API_ERROR_CODES_ [ 'OP_FAILED' ] . value error = _API_ERROR_MESSAGES_ [ 'OP_FAILED' ] . value miner_id = - 1 response = { "status" : status , "error" : error , "id" : miner_id } return jsonify ( data = [ response ] )
Adds a Miner Object via the REST API
e.g.
Adds a Miner Object via the REST API e . g .
"""
    Adds a Miner Object via the REST API
    e.g.:  http://localhost:5000/minermedic/api/v1/add_miner/192.168.1.223/17

    Please Note - when adding a Miner from the UI, this endpoint is NOT CALLED.
    Instead, the __add_object_internal API call is called in the core REST API.
    This endpoint is a convenience method for other 3rd party implementations.

    :param ip_address: The IP address of the Miner to add
    :param model_id: The Model ID of the Miner to add
    :return: JSON response including new Miner ID if successful
    """
JSON response including new Miner ID if successful
JSON response including new Miner ID if successful
ip_address
The IP address of the Miner to add
The IP address of the Miner to add
model_id
The Model ID of the Miner to add
The Model ID of the Miner to add