devo_ml.modelmanager.api#
Low-level HTTP API Rest access in a Requests library wrapper.
- validate_or_raise_error(status_code, response)[source]#
 Checks whether a decoded response is valid.
Depend on the status code value will raise an exception. Only 2xx status code are considered valid.
- Parameters:
 - Raises:
 ModelManagerError – If is not a valid status code.
- Return type:
 - Returns:
 Nothing
- class Api(auth=None, **kwargs)[source]#
 Low level api calls based on Requests lib.
- __init__(auth=None, **kwargs)[source]#
 Creates a
Api.- Parameters:
 auth (
Optional[Callable[[PreparedRequest],PreparedRequest]]) – The authentication to usekwargs – Options to the underlying requests
- __getattr__(attr)[source]#
 Saves method to call if attr is a valid method. Otherwise, built-in followed.
- Parameters:
 attr – The attribute name to get
- Returns:
 The object itself or the attribute value
- request(endpoint, **kwargs)[source]#
 Wraps a requests call to catch any error in
ModelManagerError.- Parameters:
 - Raises:
 ModelManagerError – if any
RequestException.- Return type:
 - Returns:
 Request response
- build_request_options(**kwargs)[source]#
 Builds the options for a request by merging the
Apiobject request options with the options provided.The options provided take precedence over the options in the
Apiobject.- Parameters:
 kwargs – Custom request options
- Return type:
 - Returns:
 Merged request options