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

What to specify for BOUNDARY_SERVICE_THROTTLE #45

Open
mikejcorey opened this issue Apr 30, 2014 · 1 comment
Open

What to specify for BOUNDARY_SERVICE_THROTTLE #45

mikejcorey opened this issue Apr 30, 2014 · 1 comment

Comments

@mikejcorey
Copy link

I'm getting an error when running boundaryservice installed from this repo. What am I supposed to set in my settings as BOUNDARY_SERVICE_THROTTLE?

@mikejcorey
Copy link
Author

Oops, I see that it's outlined in the README. However, I'm getting an error when I use the sample:

settings.py:

BOUNDARY_SERVICE_THROTTLE = {
    "timeframe": 60,  # timeframe to consider for throttling. In seconds
    "throttle_at": 100,  # number of requests in the timeframe before blocking
    "expiration": 3600  # How long to cache records of client requests
}

Error message upon visiting an API URI:

{"error_message": "'NoneType' object is not iterable", "traceback": "Traceback (most recent call last):\n\n  File \"/home/michaelcorey/.Envs/cir_boundary_service/local/lib/python2.7/site-packages/tastypie/resources.py\", line 195, in wrapper\n    response = callback(request, *args, **kwargs)\n\n  File \"/home/michaelcorey/.Envs/cir_boundary_service/local/lib/python2.7/site-packages/tastypie/resources.py\", line 435, in dispatch_detail\n    return self.dispatch('detail', request, **kwargs)\n\n  File \"/home/michaelcorey/.Envs/cir_boundary_service/local/lib/python2.7/site-packages/tastypie/resources.py\", line 454, in dispatch\n    self.throttle_check(request)\n\n  File \"/home/michaelcorey/.Envs/cir_boundary_service/local/lib/python2.7/site-packages/tastypie/resources.py\", line 554, in throttle_check\n    if self._meta.throttle.should_be_throttled(identifier):\n\n  File \"/home/michaelcorey/.Envs/cir_boundary_service/local/lib/python2.7/site-packages/boundaryservice/throttle.py\", line 11, in should_be_throttled\n    return super(AnonymousThrottle, self).should_be_throttled(identifier, **kwargs)\n\n  File \"/home/michaelcorey/.Envs/cir_boundary_service/local/lib/python2.7/site-packages/tastypie/throttle.py\", line 87, in should_be_throttled\n    times_accessed = [access for access in cache.get(key) if access >= minimum_time]\n\nTypeError: 'NoneType' object is not iterable\n"}

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