module netrest.rest_helper
¶
Short summary¶
module lightmlrestapi.netrest.rest_helper
Helpers to submit REST API requests.
Functions¶
function |
truncated documentation |
---|---|
Builds a REST request to compute the prediction of a machine learning model upload with |
|
Builds a REST request to upload a machine learned models to a REST API defined by |
|
Submits a request to a REST API defined by |
Documentation¶
Helpers to submit REST API requests.
- lightmlrestapi.netrest.rest_helper.json_predict_model(name, data, format='json')¶
Builds a REST request to compute the prediction of a machine learning model upload with
json_upload_model
. See alsoMLStoragePost
.- Parameters:
name – name of the model, should be unique and not already used
data – any kind of data the model request
format –
'json'
or'image'
- Returns:
dictionary ready to be jsonified
- lightmlrestapi.netrest.rest_helper.json_upload_model(name, pyfile, data=None)¶
Builds a REST request to upload a machine learned models to a REST API defined by
MLStoragePost
.- Parameters:
name – name of the model, should be unique and not already used
pyfile – python file which computes the prediction, the file must follows the specification defined in Templates
data – binary file, usually everything the models pickled
- Returns:
dictionary ready to be jsonified
- lightmlrestapi.netrest.rest_helper.submit_rest_request(request, login=None, pwd=None, url='http://127.0.0.1:8081/', timeout=50, fLOG=None)¶
Submits a request to a REST API defined by
MLStoragePost
.- Parameters:
login – login
pwd – password
request – request as a dictionary
url – url
timeout – timeout
fLOG – logging function
- Returns:
request results as dictionary