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

Poor error handling if hitting the max number of requests #5

Open
jolexa opened this issue Jan 1, 2016 · 0 comments
Open

Poor error handling if hitting the max number of requests #5

jolexa opened this issue Jan 1, 2016 · 0 comments

Comments

@jolexa
Copy link

jolexa commented Jan 1, 2016

Hello, thanks for opensourcing this little project. I'm reporting a minor issue, not a big deal so I'm not expecting it to get fixed since the resolution is to just try later.

Rate limiting
The CloudFlare API sets a maximum of 1,200 requests in a five minute period
https://api.cloudflare.com/#requests

If you exceed this rate limit while using whitelist.py then you will get a successful log message without successfully hitting the CF API.

<snip>
2016-01-01 20:48:25,782 [ERROR]: Error deleting access rule 565c6267c40dbd004bae4ef063c64136 (IP: 197.231.221.211)
Traceback (most recent call last):
  File "./whitelist.py", line 265, in main
    remove_access_rule(session, rule_id, zone_id)
  File "./whitelist.py", line 116, in remove_access_rule
    r.raise_for_status()
  File "/usr/lib64/python2.7/site-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 429 Client Error: Too Many Requests for url: https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/565c6267c40dbd004bae4ef063c64136
2016-01-01 20:48:25,783 [INFO]: Removed 799 matching Tor access rules.

The last line is what I am talking about. This is probably only an issue with accounts that have multiple domains, etc. Using default value, the problem will not present itself.

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

1 participant