Add rate limiting for any API calls

Review Request #8839 - Created March 24, 2017 and discarded

Raman Dhatt
Djblets
master
8698
8868
djblets, students

There's been a request to create a rate-limit for API calls. I have updated the ratelimit.py file that will allow rate limiting of API calls by either an authenticated user or an IP address.

None at the moment.

  • 0
  • 0
  • 23
  • 6
  • 29
Description From Last Updated
Checks run (1 failed, 1 succeeded, 1 failed with error)
JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Raman Dhatt
Raman Dhatt
Raman Dhatt
Review request changed

Change Summary:

Accidentally uploaded both patches to same review request - fixed.

Diff:

Revision 2 (+88 -14)

Show changes

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Barret Rennie
  1. 
      
  2. djblets/auth/ratelimit.py (Diff revision 2)
     
     
     
     
     

    This should not be ALLCAPS. Only class-level and top-level constants are all-caps.

  3. djblets/auth/ratelimit.py (Diff revision 2)
     
     
     
     

    This can be simplified to:

    if not api_limit:
        #...
    else:
        # ...
    
  4. djblets/auth/ratelimit.py (Diff revision 2)
     
     

    Shouldnt the default param be self.DEFAULT_RATE ?

  5. djblets/auth/ratelimit.py (Diff revision 2)
     
     

    This should be the default_rate

  6. djblets/webapi/resources/mixins/api_ratelimit.py (Diff revision 2)
     
     
     
     
     

    Re-flow this to 79ch wide.

  7. This should use a constant instead of repeating 5/m everywhere.

  8. 
      
Raman Dhatt
Review request changed

Commit:

-18936d77b24c18efdb1f351a58436d2edf8c0458
+dc795ba46ebe4549d55a7c057963e299597c0e35

Diff:

Revision 3 (+101 -14)

Show changes

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Raman Dhatt
Review request changed

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Raman Dhatt
Review request changed

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Raman Dhatt
Review request changed

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Raman Dhatt
Raman Dhatt
Raman Dhatt
Raman Dhatt
Review request changed

Checks run (1 failed, 1 succeeded, 1 failed with error)

JSHint passed.
PEP8 Style Checker internal error.
Pyflakes failed.

Pyflakes

Raman Dhatt
Raman Dhatt
David Trowbridge
Review request changed

Status: Discarded

Change Summary:

Discarding in favor of https://reviews.reviewboard.org/r/9114/

Loading...