cdh.rest.client.clients.resources module
- class cdh.rest.client.clients.resources.ResourceClient[source]
Bases:
BaseClient
Default API client for resources
- contribute_to_class(cls, _) None [source]
This configures the client to the specific resources class
- delete(obj=None, **kwargs)[source]
Performs a delete operation.
- Parameters
obj – A resources object to retrieve path variable values from
kwargs – Any additional http parameters to sent
- Returns
a bool indicating if the request was executed successfully
- get(**kwargs)[source]
Gets a resources from the API. Either over GET or GET_OVER_POST, depending on configuration.
Any kwargs supplied, that are not used for path variables, will be sent to the API. In case of GET, these will be supplied as parameters. In case of GET_OVER_POST, these will be supplied in the POST body.
- Parameters
kwargs – Any additional info to be sent.
- Returns
- put(obj, return_resource=None, as_json=None, **kwargs)[source]
Posts a resources to the API. Please note that while it’s called put, the actual HTTP method used is POST. PUT is not as supported as POST in many API frameworks, including Django.
Any kwargs supplied, that are not used for path variables, will be sent to the API as parameters.
Update/creation/update behaviour is up to the API.
- Parameters
obj – The resources to be sent in the POST body.
return_resource – An optional class that describes the resources
that the server returns as a response. (A default can be specified on a resources level) :param as_json: If the request’s json argument should be used over ‘data’. Defaults to False. When True, the client will send the data as a JSON string to the server. If False, it will instead encode the data as ‘multipart/form-data’. JSON is more flexible, as it allows for nested data structures. :param kwargs: Any additional info to be sent. :return: A return_response instance, or a Boolean (False indicated a connection error)