-
Notifications
You must be signed in to change notification settings - Fork 12
Description
The API calls for DELETE do not appear to be working correctly. Appears that DELETE only accepts inputs for 'params' (API BODY) but not for API 'fields'.
For example, a quota: I can get a filtered list of quotas by specifying a field
client.quotas.get(id=115)
[{'id': 115, .. [redacted]
but if I try to delete I get
>>> client.quotas.delete(id=115)
Traceback (most recent call last):
File "<python-input-12>", line 1, in <module>
client.quotas.delete(id=115)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "[redacted]/python3.13/site-packages/vastpy/__init__.py", line 105, in delete
return self.request('DELETE', data=params)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "[redacted]/python3.13/site-packages/vastpy/__init__.py", line 88, in request
raise RESTFailure(method, self._url, fields, r.status, r.data)
vastpy.RESTFailure: response for DELETE api/quotas with params=None failed with error 405 and message {"detail":"Method \"DELETE\" not allowed."}
The part that seems important to me is the "with params=None" suggesting it's not accepting the parameter filter I applied and (luckily) the API appears to have a failsafe against un-filtered delete requests.
following the code
the exception printing shows "params" referencing the "fields" attribute
super().__init__(f'response for {method} {url} with params={fields} failed with error {status} and message {data.decode("utf-8")}')
but the DELETE method only allows for populating the "data" attribute (confusing also referenced as "params" ), compare to the GET method which allows the fields.
def get(self, **params):
return self.request('GET', fields=params)
[...snip...]
def delete(self, **params):
return self.request('DELETE', data=params)
When I initially ran into this problem, I had noticed a PR to address the issue. I held off submitting an issue as it appeared to already be a known bug & in process of being fixed. But that PR has been closed without being merged.
Vast system version: 5.3.2-sp4
vastpy version: 0.3.17
Thanks,
Keith