{"action":"created","issue":{"url":"https://api.github.com/repos/jsocol/django-ratelimit/issues/62","labels_url":"https://api.github.com/repos/jsocol/django-ratelimit/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/jsocol/django-ratelimit/issues/62/comments","events_url":"https://api.github.com/repos/jsocol/django-ratelimit/issues/62/events","html_url":"https://github.com/jsocol/django-ratelimit/pull/62","id":64809302,"number":62,"title":"\"extracted\" cache key building from is_ratelimited to separate method to allow rate limit resetting.","user":{"login":"imposeren","id":1067274,"avatar_url":"https://avatars.githubusercontent.com/u/1067274?v=3","gravatar_id":"","url":"https://api.github.com/users/imposeren","html_url":"https://github.com/imposeren","followers_url":"https://api.github.com/users/imposeren/followers","following_url":"https://api.github.com/users/imposeren/following{/other_user}","gists_url":"https://api.github.com/users/imposeren/gists{/gist_id}","starred_url":"https://api.github.com/users/imposeren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imposeren/subscriptions","organizations_url":"https://api.github.com/users/imposeren/orgs","repos_url":"https://api.github.com/users/imposeren/repos","events_url":"https://api.github.com/users/imposeren/events{/privacy}","received_events_url":"https://api.github.com/users/imposeren/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-27T17:17:55Z","updated_at":"2015-03-31T11:35:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jsocol/django-ratelimit/pulls/62","html_url":"https://github.com/jsocol/django-ratelimit/pull/62","diff_url":"https://github.com/jsocol/django-ratelimit/pull/62.diff","patch_url":"https://github.com/jsocol/django-ratelimit/pull/62.patch"},"body":"This will allow to manually reset rate limits for some request. Example\r\nusage:\r\n\r\n1. captcha is shown when request.limited is True\r\n2. after captcha is passed next request ignores rate limits but following\r\nrequests will still increment \"rate usage\" above limit\r\n3. to fix problem above we can delete cache entry after succesfull\r\ncaptcha:\r\n\r\n```python\r\nrecaptcha_response = request.POST.get('g-recaptcha-response', None)\r\nif recaptcha_response:\r\n    try:\r\n        recaptcha_status = requests.post(\r\n            'https://www.google.com/recaptcha/api/siteverify',\r\n            data={\r\n                'secret': settings.RECAPTCHA_SECRET_KEY,\r\n                'response': recaptcha_response,\r\n            },\r\n        ).json()\r\n\trequest.recaptcha_success = recaptcha_status.get('success', False)\r\n\tif request.recaptcha_success:\r\n\t    ratelimit.utils.get_cache().delete(ratelimit.utils.get_cache_key_for_request(request, group, fn, key,rate,))\r\n```"},"comment":{"url":"https://api.github.com/repos/jsocol/django-ratelimit/issues/comments/88054401","html_url":"https://github.com/jsocol/django-ratelimit/pull/62#issuecomment-88054401","issue_url":"https://api.github.com/repos/jsocol/django-ratelimit/issues/62","id":88054401,"user":{"login":"imposeren","id":1067274,"avatar_url":"https://avatars.githubusercontent.com/u/1067274?v=3","gravatar_id":"","url":"https://api.github.com/users/imposeren","html_url":"https://github.com/imposeren","followers_url":"https://api.github.com/users/imposeren/followers","following_url":"https://api.github.com/users/imposeren/following{/other_user}","gists_url":"https://api.github.com/users/imposeren/gists{/gist_id}","starred_url":"https://api.github.com/users/imposeren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imposeren/subscriptions","organizations_url":"https://api.github.com/users/imposeren/orgs","repos_url":"https://api.github.com/users/imposeren/repos","events_url":"https://api.github.com/users/imposeren/events{/privacy}","received_events_url":"https://api.github.com/users/imposeren/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T11:35:03Z","updated_at":"2015-03-31T11:35:03Z","body":"> I don't really want to add the dependency, particularly that dependency, which dramatically increases traffic to the cache, when the goal of this library is to protect infrastructure.\r\nI think that this can be easily implemented as configurable option. I'll create separate issue or pull request for that with more details\r\n\r\nWhat about this pull request? As I mentioned -- it will allow to reset limits which is also required in #36\r\n\r\n```python\r\nif request.recaptcha_success:\r\n        ratelimit.utils.get_cache().delete(ratelimit.utils.get_cache_key_for_request(request, group, fn, key,rate,))\r\n```"}}