Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup method can raise HTTP 400 with errors body #27

Open
chkwok opened this issue Dec 6, 2018 · 1 comment
Open

Lookup method can raise HTTP 400 with errors body #27

chkwok opened this issue Dec 6, 2018 · 1 comment

Comments

@chkwok
Copy link

chkwok commented Dec 6, 2018

When looking up a phone number to do preliminary validation, the API can raise a HTTPError instead of ErrorException, as the HTTP status code 400 is not handled in the client.

Raising an ErrorException would be more consistent, as a HTTPError usually indicates networking errors or bad requests, not "phone number seems invalid".

Sample response:

x
Out[91]: requests.exceptions.HTTPError('400 Client Error: Bad Request for url: https://rest.messagebird.com/lookup/1234567890')

x.response.content
Out[92]: b'{"errors":[{"code":21,"description":"Bad request (phone number has unknown format)","parameter":"phone_number"}]}\n'```
@sehmaschine
Copy link

just experienced this one as well. very annoying. and not fixed since 2018!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants