Open therefromhere opened 5 years ago
Thanks, will try to look into this.
@therefromhere this may have been fixed in my recent PR.
I suspect that pet/$id/position
was only ever intended (or has since been repurposed) to be for setting the position with a POST. In any event, that endpoint now returns a 405 to a GET, and I've reworked it to get the same info by other means. OTOH, if the animal has never gone through the flap, it may still fail if there is no information to return.
First off, great work on this project! A minor bug I've found -
I'm seeing a 204 response from https://app.api.surehub.io/api/pet//position for a cat that's been added to the catflap but has never gone through it, so they're not showing as either inside or outside in the app.
_get_data doesn't handle 204, so it blows up trying to JSON decode an empty response (with
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
).The no-code workaround is to explicitly set any newly added pets to a location (eg inside) using the app.