Closed ollipa closed 2 years ago
Is this happening on 1.18.0?
I just tested this with 1.18.1 and the bug is still present.
So there seem to be two issues:
1) that's not the only endpoint: See https://community.meraki.com/t5/Developers-APIs/Bug-in-AIO-SDK-for-generateDeviceCameraSnapshot/m-p/139036 there is now a case open for a very long time and nothing is happening =( 2) I could implement a workaround in the library for that, but I think that should be done on the server side. Since this would probably a small change on the server, I thought that it would have been fixed long time ago =(
I'll keep an eye on this. The non-aio version of the library doesn't have this problem, from what I can see.
The non-aio version doesn't check for the content-type, thats why it doesn't have that problem. I've removed the content-type check for now in PR #181. This should do the trick until the cloud is fixed
Hi team, I'm pretty sure the fix is deployed. I tested on my end and couldn't reproduce. Anyone else care to try? @ollipa ?
@TKIPisalegacycipher, claim endpoint seems to be fixed now but I can still reproduce the issue with removeNetworkDevices call.
> await client.networks.removeNetworkDevices(network_id, serial)
ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('https://api.meraki.com/api/v1/networks/***/devices/remove')
# No ContentTypeError if the device has already been removed or does not exist:
> await client.networks.removeNetworkDevices(network_id, serial)
AsyncAPIError: networks, removeNetworkDevices - 404 Not Found, None
@TKIPisalegacycipher .../camera/generateSnapshot is also not fixed
Thanks for the follow-up. removeNetworkDevices
returns a 204 No Content
-- why is a content-type
expected?
A fix for the snapshot endpoint on the other hand is in progress.
Quick update: the snapshot issue is one with the endpoint, not with the library. Meraki plan to fix the snapshot endpoint, since it returns content.
However, 204 No Content responses are not expected to return a content-type, so no application should require one of the endpoint. If there are any other concerns, please reply here.
I will limit the response.json() to a 200 ok like in the non async version
From the ClientResponse.json() Documentation
Returns: BODY as JSON data parsed by loads parameter or None if BODY is empty or contains white-spaces only.
The issue is still the wrong mime-type here.
Just out of curiosity: removeNetworkDevices is currently using POST. All other endpoints which are removing something are using DELETE. Delete methods will never return something.
Just like claim endpoints respond with a list of what was claimed, perhaps removeNetworkDevices should return a body of what was removed. These devices are not really being 'deleted' so I'm not sure a DELETE action is that intuitive. On top of that, DELETE requests don't typically have bodies--we want to support removing many serials at once, and if you want to do that, a DELETE action would require sending one delete request per serial. That seems needlessly inefficient.
I think this is solved. Please raise a new issue referencing this one if you are still having similar issues.
When claiming or removing a device from a network, a ContentTypeError is raised. The operation itself is successful.
Library version: 1.18.1 Python version: 3.9
Code to reproduce:
Stack trace: