Open Te-k opened 7 years ago
i'm also getting "AttributeError: 'NoneType' object has no attribute 'read'"
Any update how to fix this issue?
@fr1d4yyy If it is the same exception than the one in my code, it only means that the pulse requested does not exist. It is ugly and it would be better to have either a custom exception or return code, but it is totally usable (if it happens in another case, you should open a new issue I think)
I fixed this in a few places - there are probably more, I'll look into it more when I have time.
There are actually 2 separate issues here. One is that for historical reasons, you won't even really get a 404 if your pulse_id isn't recognizable to the web server (it needs to be a 24-character hex string). So I made it so that get_pulse_details and get_pulse_indicators will raise BadRequest if the pulse_id doesn't match expectations.
If the pulse_id is valid, but is not found, a new exception will be thrown, called NotFound.
I added a few simple tests for this, seems to be working ok. Code is in master, will be in a patch release soon.
When requesting an non-existent pulse, with pip version 1.2:
With masterbranch (commit da9cd3472f84d167ac7cab5da600c76f6f04f520 ):
It would be way better to raise a custom exception here.