Open ozroc opened 7 years ago
Service was having some issues, try again. It's most likely fixed now.
Whoops, deleted my comment! For posterity, this is what I wrote:
I mean, ideally Pushjet shouldn't do this kind of thing... Methinks @Mechazawa's got some splainin' to do.
Perhaps I should add a few more checks for malformed responses! I'll see when I have time. I tried this out just now, but the Pushjet server just gives me a 502 Bad Gateway for every request I send, whatever the endpoint. Hrm HRM @Mechazawa cough hack sorry, frog in my throat. 😅
@Mechazawa Yup, seems to be up again! Seems to be an old version, though...? HTTP status codes aren't being returned as they should be - we're back in 200 land.
It works perfectly now.
Anyway, I think it could be easy to check responses and raise better exceptions. I'll take a look at it and try to make a PR.
Thanks friends!
Looks like the reason it seemed like an empty object was being returned was because of these lines in Api._request
:
try:
response = r.json()
except ValueError:
response = {}
That's probably not the way to handle that. I should probably turn malformed responses and 502s (perhaps other status codes, too?) into ServerError
s.
Hello. I've found an issue with this simple test:
It just raises an exception:
Digging a little bit, the response arrives empty.
Maybe this is caused by a server issue, but I think an additional check for a empty response and a more accurate exception would help.
Thank you!