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

Check for quota "402 Payment Required" #13

Closed
theconor opened this issue Aug 15, 2015 · 1 comment
Closed

Check for quota "402 Payment Required" #13

theconor opened this issue Aug 15, 2015 · 1 comment

Comments

@theconor
Copy link

The geocoder.py current checks only for HTTP response 429 "Too many requests" to raise the quota exceeded error. However, for me at least, the code OpenCage sends me is 402 "Payment required". The python module does not detect this alternative code and just gives me empty results list.

Ideal fix would be to make this check more robust - check the JSON as well as the HTTP header. Here is a sample:
"rate":{"limit":2500,"remaining":0,"reset":1439683200},"results":[],"status":{"code":402,"message":"quota exceeded"},
X-RateLimit-Remaining:"0"

Note another handy feature would be the ability to query the geocoder object for the number of calls remaining and the reset time. This would allow the client to prioritise data to be parsed.

@mtmail
Copy link
Member

mtmail commented Aug 20, 2015

Thanks a lot for the bug report!
I released version 1.1.4 which correctly looks for HTTP response 402.

@mtmail mtmail closed this as completed May 13, 2019
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