{"action":"created","comment":{"url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/comments/202992740","pull_request_review_id":137793156,"id":202992740,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjk5Mjc0MA==","diff_hunk":"@@ -103,21 +113,27 @@ def has_been_reached(self):\n         \"\"\"\n         return self.get_usage() >= self._max_requests\n \n-    def increment_usage(self):\n+    def increment_usage(self, increment_by=1):\n         \"\"\"\n         Calls a LUA script that should increment the resource usage by client.\n \n         If the resource limit overflows the maximum number of requests, this\n         method raises an Exception.\n \n+        :param increment_by: The count to increment the rate limiter by.\n+        This is typically 1, but higher or lower values are provided","path":"redis_rate_limit/__init__.py","position":41,"original_position":41,"commit_id":"aac9c2d01f681e61d46c2e7b9af2cac682efbcdf","original_commit_id":"aac9c2d01f681e61d46c2e7b9af2cac682efbcdf","user":{"login":"jamesmishra","id":3060429,"node_id":"MDQ6VXNlcjMwNjA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/3060429?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesmishra","html_url":"https://github.com/jamesmishra","followers_url":"https://api.github.com/users/jamesmishra/followers","following_url":"https://api.github.com/users/jamesmishra/following{/other_user}","gists_url":"https://api.github.com/users/jamesmishra/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmishra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmishra/subscriptions","organizations_url":"https://api.github.com/users/jamesmishra/orgs","repos_url":"https://api.github.com/users/jamesmishra/repos","events_url":"https://api.github.com/users/jamesmishra/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmishra/received_events","type":"User","site_admin":false},"body":"Yeah, the code doesn't currently check against negative values, but I could add one.\r\n\r\nI think the more common scenario might be to increase the bucket size instead of decreasing the request number.","created_at":"2018-07-17T11:57:50Z","updated_at":"2018-07-17T11:57:51Z","html_url":"https://github.com/EvoluxBR/python-redis-rate-limit/pull/16#discussion_r202992740","pull_request_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/comments/202992740"},"html":{"href":"https://github.com/EvoluxBR/python-redis-rate-limit/pull/16#discussion_r202992740"},"pull_request":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16"}},"in_reply_to_id":202567770},"pull_request":{"url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16","id":199823041,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5ODIzMDQx","html_url":"https://github.com/EvoluxBR/python-redis-rate-limit/pull/16","diff_url":"https://github.com/EvoluxBR/python-redis-rate-limit/pull/16.diff","patch_url":"https://github.com/EvoluxBR/python-redis-rate-limit/pull/16.patch","issue_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues/16","number":16,"state":"open","locked":false,"title":"Enable increment_usage() to increment by more than 1 at a time","user":{"login":"jamesmishra","id":3060429,"node_id":"MDQ6VXNlcjMwNjA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/3060429?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesmishra","html_url":"https://github.com/jamesmishra","followers_url":"https://api.github.com/users/jamesmishra/followers","following_url":"https://api.github.com/users/jamesmishra/following{/other_user}","gists_url":"https://api.github.com/users/jamesmishra/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmishra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmishra/subscriptions","organizations_url":"https://api.github.com/users/jamesmishra/orgs","repos_url":"https://api.github.com/users/jamesmishra/repos","events_url":"https://api.github.com/users/jamesmishra/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmishra/received_events","type":"User","site_admin":false},"body":"This helps with various rate limiting schemes where different\r\noperations have different costs or credit usages.\r\nincrement_usage() can be used to increment the rate limiter\r\nby an arbitrary amount.\r\n\r\nThis code also does not screen for negative numbers, so it\r\nis possible to decrement the rate limit count if necessary.","created_at":"2018-07-06T18:52:47Z","updated_at":"2018-07-17T11:57:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c92ac96ad05a4a1e66064104c310fa1762eb8a7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16/commits","review_comments_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16/comments","review_comment_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues/16/comments","statuses_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/statuses/aac9c2d01f681e61d46c2e7b9af2cac682efbcdf","head":{"label":"jamesmishra:increment-by","ref":"increment-by","sha":"aac9c2d01f681e61d46c2e7b9af2cac682efbcdf","user":{"login":"jamesmishra","id":3060429,"node_id":"MDQ6VXNlcjMwNjA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/3060429?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesmishra","html_url":"https://github.com/jamesmishra","followers_url":"https://api.github.com/users/jamesmishra/followers","following_url":"https://api.github.com/users/jamesmishra/following{/other_user}","gists_url":"https://api.github.com/users/jamesmishra/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmishra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmishra/subscriptions","organizations_url":"https://api.github.com/users/jamesmishra/orgs","repos_url":"https://api.github.com/users/jamesmishra/repos","events_url":"https://api.github.com/users/jamesmishra/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmishra/received_events","type":"User","site_admin":false},"repo":{"id":140018160,"node_id":"MDEwOlJlcG9zaXRvcnkxNDAwMTgxNjA=","name":"python-redis-rate-limit","full_name":"jamesmishra/python-redis-rate-limit","owner":{"login":"jamesmishra","id":3060429,"node_id":"MDQ6VXNlcjMwNjA0Mjk=","avatar_url":"https://avatars1.githubusercontent.com/u/3060429?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesmishra","html_url":"https://github.com/jamesmishra","followers_url":"https://api.github.com/users/jamesmishra/followers","following_url":"https://api.github.com/users/jamesmishra/following{/other_user}","gists_url":"https://api.github.com/users/jamesmishra/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesmishra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesmishra/subscriptions","organizations_url":"https://api.github.com/users/jamesmishra/orgs","repos_url":"https://api.github.com/users/jamesmishra/repos","events_url":"https://api.github.com/users/jamesmishra/events{/privacy}","received_events_url":"https://api.github.com/users/jamesmishra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamesmishra/python-redis-rate-limit","description":"Python Rate Limiter implemented based on Redis INCR, EXPIRE, EVALSHA and EVAL.","fork":true,"url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit","forks_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/forks","keys_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/teams","hooks_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/hooks","issue_events_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/issues/events{/number}","events_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/events","assignees_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/assignees{/user}","branches_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/branches{/branch}","tags_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/tags","blobs_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/statuses/{sha}","languages_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/languages","stargazers_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/stargazers","contributors_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/contributors","subscribers_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/subscribers","subscription_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/subscription","commits_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/issues/comments{/number}","contents_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/contents/{+path}","compare_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/merges","archive_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/downloads","issues_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/issues{/number}","pulls_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/pulls{/number}","milestones_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/milestones{/number}","notifications_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/labels{/name}","releases_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/releases{/id}","deployments_url":"https://api.github.com/repos/jamesmishra/python-redis-rate-limit/deployments","created_at":"2018-07-06T18:27:41Z","updated_at":"2018-07-13T05:01:21Z","pushed_at":"2018-07-13T05:01:20Z","git_url":"git://github.com/jamesmishra/python-redis-rate-limit.git","ssh_url":"git@github.com:jamesmishra/python-redis-rate-limit.git","clone_url":"https://github.com/jamesmishra/python-redis-rate-limit.git","svn_url":"https://github.com/jamesmishra/python-redis-rate-limit","homepage":"","size":29,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"increment-by"}},"base":{"label":"EvoluxBR:master","ref":"master","sha":"7467f21182e1b5d940ae3f106a1405da693b2a42","user":{"login":"EvoluxBR","id":1097626,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwOTc2MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1097626?v=4","gravatar_id":"","url":"https://api.github.com/users/EvoluxBR","html_url":"https://github.com/EvoluxBR","followers_url":"https://api.github.com/users/EvoluxBR/followers","following_url":"https://api.github.com/users/EvoluxBR/following{/other_user}","gists_url":"https://api.github.com/users/EvoluxBR/gists{/gist_id}","starred_url":"https://api.github.com/users/EvoluxBR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EvoluxBR/subscriptions","organizations_url":"https://api.github.com/users/EvoluxBR/orgs","repos_url":"https://api.github.com/users/EvoluxBR/repos","events_url":"https://api.github.com/users/EvoluxBR/events{/privacy}","received_events_url":"https://api.github.com/users/EvoluxBR/received_events","type":"Organization","site_admin":false},"repo":{"id":63997812,"node_id":"MDEwOlJlcG9zaXRvcnk2Mzk5NzgxMg==","name":"python-redis-rate-limit","full_name":"EvoluxBR/python-redis-rate-limit","owner":{"login":"EvoluxBR","id":1097626,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwOTc2MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1097626?v=4","gravatar_id":"","url":"https://api.github.com/users/EvoluxBR","html_url":"https://github.com/EvoluxBR","followers_url":"https://api.github.com/users/EvoluxBR/followers","following_url":"https://api.github.com/users/EvoluxBR/following{/other_user}","gists_url":"https://api.github.com/users/EvoluxBR/gists{/gist_id}","starred_url":"https://api.github.com/users/EvoluxBR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EvoluxBR/subscriptions","organizations_url":"https://api.github.com/users/EvoluxBR/orgs","repos_url":"https://api.github.com/users/EvoluxBR/repos","events_url":"https://api.github.com/users/EvoluxBR/events{/privacy}","received_events_url":"https://api.github.com/users/EvoluxBR/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/EvoluxBR/python-redis-rate-limit","description":"Python Rate Limiter implemented based on Redis INCR, EXPIRE, EVALSHA and EVAL.","fork":false,"url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit","forks_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/forks","keys_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/teams","hooks_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/hooks","issue_events_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues/events{/number}","events_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/events","assignees_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/assignees{/user}","branches_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/branches{/branch}","tags_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/tags","blobs_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/git/refs{/sha}","trees_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/statuses/{sha}","languages_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/languages","stargazers_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/stargazers","contributors_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/contributors","subscribers_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/subscribers","subscription_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/subscription","commits_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/commits{/sha}","git_commits_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/git/commits{/sha}","comments_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/comments{/number}","issue_comment_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues/comments{/number}","contents_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/contents/{+path}","compare_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/merges","archive_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/downloads","issues_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues{/number}","pulls_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls{/number}","milestones_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/milestones{/number}","notifications_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/labels{/name}","releases_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/releases{/id}","deployments_url":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/deployments","created_at":"2016-07-23T03:50:41Z","updated_at":"2018-07-05T03:46:58Z","pushed_at":"2018-07-13T05:01:21Z","git_url":"git://github.com/EvoluxBR/python-redis-rate-limit.git","ssh_url":"git@github.com:EvoluxBR/python-redis-rate-limit.git","clone_url":"https://github.com/EvoluxBR/python-redis-rate-limit.git","svn_url":"https://github.com/EvoluxBR/python-redis-rate-limit","homepage":"","size":25,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14,"open_issues":3,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16"},"html":{"href":"https://github.com/EvoluxBR/python-redis-rate-limit/pull/16"},"issue":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues/16"},"comments":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/EvoluxBR/python-redis-rate-limit/statuses/aac9c2d01f681e61d46c2e7b9af2cac682efbcdf"}},"author_association":"NONE"}}
{"actor":{"display_login":"jamesmishra"}}